You are here

protected function ApigeeEdgeCommandsTest::setUp in Apigee Edge 8

Overrides UnitTestCase::setUp

File

tests/src/Unit/Commands/ApigeeEdgeCommandsTest.php, line 62

Class

ApigeeEdgeCommandsTest
Test ApigeeEdgeCommands class.

Namespace

Drupal\Tests\apigee_edge\Unit\Commands

Code

protected function setUp() {
  parent::setUp();
  $this->cliService = $this
    ->prophesize(CliServiceInterface::class);
  $this->apigeeEdgeCommands = new ApigeeEdgeCommands($this->cliService
    ->reveal());

  // Set io in DrushCommands to a mock.
  $apigee_edge_commands_reflection = new ReflectionClass($this->apigeeEdgeCommands);
  $reflection_io_property = $apigee_edge_commands_reflection
    ->getProperty('io');
  $reflection_io_property
    ->setAccessible(TRUE);
  $this->io = $this
    ->prophesize(DrushStyle::class);
  $reflection_io_property
    ->setValue($this->apigeeEdgeCommands, $this->io
    ->reveal());
  $this->io
    ->askHidden(Argument::type('string'), Argument::any())
    ->willReturn('I<3APIS!');
}