PasswordTest.php 567 B

12345678910111213141516171819202122
  1. <?php
  2. namespace League\CLImate\Tests\TerminalObject\Dynamic;
  3. use League\CLImate\Tests\TestBase;
  4. class PasswordTest extends TestBase
  5. {
  6. /** @test */
  7. public function it_will_hide_the_user_response()
  8. {
  9. $this->shouldReceiveSameLine();
  10. $this->shouldWrite("\e[mGimmie the secret: \e[0m");
  11. $this->reader->shouldReceive('hidden')->andReturn('mypasswordyo');
  12. $input = $this->cli->password('Gimmie the secret:', $this->reader);
  13. $response = $input->prompt();
  14. $this->assertSame($response, 'mypasswordyo');
  15. }
  16. }