PwdShellTest.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. App::uses('PwdShell', 'Tools.Console/Command');
  3. App::uses('MyCakeTestCase', 'Tools.TestSuite');
  4. App::uses('TestConsoleOutput', 'Tools.TestSuite');
  5. class PwdShellTest extends MyCakeTestCase {
  6. public $PwdShell;
  7. /**
  8. * PwdShellTest::setUp()
  9. *
  10. * @return void
  11. */
  12. public function setUp() {
  13. parent::setUp();
  14. $output = new TestConsoleOutput();
  15. $error = $this->getMock('ConsoleOutput', array(), array(), '', false);
  16. $input = $this->getMock('ConsoleInput', array(), array(), '', false);
  17. $this->PwdShell = new PwdShell($output, $error, $input);
  18. }
  19. /**
  20. * PwdShellTest::testObject()
  21. *
  22. * @return void
  23. */
  24. public function testObject() {
  25. $this->assertTrue(is_object($this->PwdShell));
  26. $this->assertInstanceOf('PwdShell', $this->PwdShell);
  27. }
  28. /**
  29. * PwdShellTest::testHash()
  30. *
  31. * @return void
  32. */
  33. public function testHash() {
  34. $this->PwdShell->stdin->expects($this->at(0))
  35. ->method('read')
  36. ->will($this->returnValue('123'));
  37. $this->PwdShell->startup();
  38. $this->PwdShell->hash();
  39. $output = $this->PwdShell->stdout->output();
  40. $this->assertNotEmpty($output);
  41. }
  42. }