HoaConsoleTest.php 905 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. /*
  3. * This file is part of Psy Shell.
  4. *
  5. * (c) 2012-2017 Justin Hileman
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Psy\Test\Readline;
  11. use Psy\Readline\HoaConsole;
  12. class HoaConsoleTest extends \PHPUnit_Framework_TestCase
  13. {
  14. public function testHistory()
  15. {
  16. $readline = new HoaConsole();
  17. $this->assertEmpty($readline->listHistory());
  18. $readline->addHistory('foo');
  19. $this->assertEquals(array('foo'), $readline->listHistory());
  20. $readline->addHistory('bar');
  21. $this->assertEquals(array('foo', 'bar'), $readline->listHistory());
  22. $readline->addHistory('baz');
  23. $this->assertEquals(array('foo', 'bar', 'baz'), $readline->listHistory());
  24. $readline->clearHistory();
  25. $this->assertEmpty($readline->listHistory());
  26. }
  27. }