HoaConsoleTest.php 884 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. /*
  3. * This file is part of Psy Shell.
  4. *
  5. * (c) 2012-2018 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->assertSame(['foo'], $readline->listHistory());
  20. $readline->addHistory('bar');
  21. $this->assertSame(['foo', 'bar'], $readline->listHistory());
  22. $readline->addHistory('baz');
  23. $this->assertSame(['foo', 'bar', 'baz'], $readline->listHistory());
  24. $readline->clearHistory();
  25. $this->assertEmpty($readline->listHistory());
  26. }
  27. }