You are here

public function ApigeeEdgeCommandsTest::testValidatePasswordParam in Apigee Edge 8

Test validateCreateEdgeRole function does not prompt for password.

When password option is set, do not prompt for password.

File

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

Class

ApigeeEdgeCommandsTest
Test ApigeeEdgeCommands class.

Namespace

Drupal\Tests\apigee_edge\Unit\Commands

Code

public function testValidatePasswordParam() {
  $command_data_input = $this
    ->prophesize(InputInterface::class);
  $command_data_input
    ->getOption('password')
    ->willReturn('secret');
  $command_data_input
    ->getArgument('email')
    ->willReturn('email.example.com');
  $command_data = $this
    ->prophesize(CommandData::class);
  $command_data
    ->input()
    ->willReturn($command_data_input
    ->reveal());
  $this->apigeeEdgeCommands
    ->validateCreateEdgeRole($command_data
    ->reveal());

  // Make sure password was not prompted to user.
  $command_data_input
    ->getOption('password')
    ->shouldHaveBeenCalled();
  $this->io
    ->askHidden(Argument::type('string'), Argument::any())
    ->shouldNotBeCalled();
  $command_data_input
    ->setOption()
    ->shouldNotHaveBeenCalled();
}