You are here

public function CreateEdgeRoleCommandTest::testInteractPasswordParamEmpty in Apigee Edge 8

Test validateCreateEdgeRole prompts for password.

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

File

tests/src/Unit/Command/CreateEdgeRoleCommandTest.php, line 190

Class

CreateEdgeRoleCommandTest
Test ApigeeEdgeCommands class.

Namespace

Drupal\Tests\apigee_edge\Unit\Command

Code

public function testInteractPasswordParamEmpty() {
  $this->input
    ->getArgument(Argument::type('string'))
    ->willReturn('XXX');
  $this->input
    ->getOption('password')
    ->willReturn(NULL);
  $this->input
    ->getOption(Argument::type('string'))
    ->willReturn('XXX');
  $this->input
    ->setOption(Argument::type('string'), NULL)
    ->willReturn(NULL);
  $this->input
    ->isInteractive()
    ->willReturn(FALSE);
  $this->createEdgeRoleCommand
    ->interact($this->input
    ->reveal(), $this->output
    ->reveal());

  // Interact should not change password since it was passed in.
  $this->input
    ->getOption('password')
    ->shouldHaveBeenCalled();
  $this->input
    ->setOption('password', NULL)
    ->shouldHaveBeenCalled();
}