You are here

public function ExecutableFinderTraitTest::testFindExecutable in Tome 8

@covers \Drupal\tome_base\ExecutableFinderTrait::findExecutable

@dataProvider dataProvider

File

modules/tome_base/tests/src/Unit/ExecutableFinderTraitTest.php, line 20

Class

ExecutableFinderTraitTest
@coversDefaultClass \Drupal\tome_base\ExecutableFinderTrait @group tome_base

Namespace

Drupal\Tests\tome_base\Unit

Code

public function testFindExecutable($first_argument, $argv, $expected) {
  $mock = $this
    ->getMockForTrait(ExecutableFinderTrait::class);
  $input = $this
    ->prophesize(InputInterface::class);
  $input
    ->getFirstArgument()
    ->willReturn($first_argument);
  $reflection = new \ReflectionMethod(get_class($mock), 'findExecutable');
  $reflection
    ->setAccessible(TRUE);
  $_SERVER['argv'] = $argv;
  $this
    ->assertEquals($expected, $reflection
    ->invoke($mock, $input
    ->reveal()));
}