You are here

public function ApigeeEdgeCommandsTest::testValidatePasswordParamEmpty in Apigee Edge 8

Test validateCreateEdgeRole prompts for password.

When password option not set, password should be inputted by user.

File

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

Class

ApigeeEdgeCommandsTest
Test ApigeeEdgeCommands class.

Namespace

Drupal\Tests\apigee_edge\Unit\Commands

Code

public function testValidatePasswordParamEmpty() {
  $command_data_input = $this
    ->prophesize(InputInterface::class);
  $command_data_input
    ->getOption('password')
    ->willReturn(NULL);
  $command_data_input
    ->setOption(Argument::type('string'), Argument::type('string'))
    ->willReturn();
  $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 not requested.
  $command_data_input
    ->getOption('password')
    ->shouldHaveBeenCalled();
  $this->io
    ->askHidden(Argument::type('string'), Argument::any())
    ->shouldBeCalled();
  $command_data_input
    ->setOption('password', 'I<3APIS!')
    ->shouldHaveBeenCalled();
}