adapter_test.php 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. // $Id: adapter_test.php 1748 2008-04-14 01:50:41Z lastcraft $
  3. require_once(dirname(__FILE__) . '/../autorun.php');
  4. require_once(dirname(__FILE__) . '/../extensions/pear_test_case.php');
  5. class SameTestClass {
  6. }
  7. class TestOfPearAdapter extends PHPUnit_TestCase {
  8. function testBoolean() {
  9. $this->assertTrue(true, "PEAR true");
  10. $this->assertFalse(false, "PEAR false");
  11. }
  12. function testName() {
  13. $this->assertTrue($this->getName() == get_class($this));
  14. }
  15. function testPass() {
  16. $this->pass("PEAR pass");
  17. }
  18. function testNulls() {
  19. $value = null;
  20. $this->assertNull($value, "PEAR null");
  21. $value = 0;
  22. $this->assertNotNull($value, "PEAR not null");
  23. }
  24. function testType() {
  25. $this->assertType("Hello", "string", "PEAR type");
  26. }
  27. function testEquals() {
  28. $this->assertEquals(12, 12, "PEAR identity");
  29. $this->setLooselyTyped(true);
  30. $this->assertEquals("12", 12, "PEAR equality");
  31. }
  32. function testSame() {
  33. $same = new SameTestClass();
  34. $this->assertSame($same, $same, "PEAR same");
  35. }
  36. function testRegExp() {
  37. $this->assertRegExp('/hello/', "A big hello from me", "PEAR regex");
  38. }
  39. }
  40. ?>