socket_test.php 773B

12345678910111213141516171819202122232425
  1. <?php
  2. // $Id: socket_test.php 1782 2008-04-25 17:09:06Z pp11 $
  3. require_once(dirname(__FILE__) . '/../autorun.php');
  4. require_once(dirname(__FILE__) . '/../socket.php');
  5. Mock::generate('SimpleSocket');
  6. class TestOfSimpleStickyError extends UnitTestCase {
  7. function testSettingError() {
  8. $error = new SimpleStickyError();
  9. $this->assertFalse($error->isError());
  10. $error->setError('Ouch');
  11. $this->assertTrue($error->isError());
  12. $this->assertEqual($error->getError(), 'Ouch');
  13. }
  14. function testClearingError() {
  15. $error = new SimpleStickyError();
  16. $error->setError('Ouch');
  17. $this->assertTrue($error->isError());
  18. $error->clearError();
  19. $this->assertFalse($error->isError());
  20. }
  21. }
  22. ?>