Sql-sync command when invoked in custom drush script is not running expectedly

Below is the command which I am running –
drush custom-sync @test.dev @test.local

Here ‘custom-sync’ is my custom drush command and ‘test’ is the site alias. In ‘test.aliases.drushrc.php’ file, aliases for dev, stage, prod and local are defined.

Output of above command –

[email protected]:/$ drush custom-sync @test.dev @test.local
You are about to execute 'sql-sync @test.dev @test.local version' non-interactively (--yes forced) on all of the following targets:
Continue?  (y/n):

Below is the code for invoking a drush sql-sync command –

  drush_invoke_process('@test, 'sql-sync', array('@test.dev', '@test.local'));

Can anybody please guide me why this command is not restricted to the source and destination which I am providing ?

Drupal version: 

Source: https://www.drupal.org/taxonomy/term/4/feed