DebugTest.php 970 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. namespace Doctrine\Tests\Common\Util;
  3. use Doctrine\Tests\DoctrineTestCase;
  4. use Doctrine\Common\Util\Debug;
  5. class DebugTest extends DoctrineTestCase
  6. {
  7. public function testExportObject( )
  8. {
  9. $obj = new \stdClass;
  10. $obj->foo = "bar";
  11. $obj->bar = 1234;
  12. $var = Debug::export($obj, 2);
  13. $this->assertEquals( "stdClass", $var->__CLASS__ );
  14. }
  15. public function testExportDateTime()
  16. {
  17. $obj = new \DateTime( "2010-10-10 10:10:10" );
  18. $var = Debug::export( $obj, 2 );
  19. $this->assertEquals( "DateTime", $var->__CLASS__ );
  20. }
  21. public function testExportArrayTraversable()
  22. {
  23. $obj = new \ArrayObject(array('foobar'));
  24. $var = Debug::export($obj, 2);
  25. $this->assertContains('foobar', $var->__STORAGE__);
  26. $it = new \ArrayIterator(array('foobar'));
  27. $var = Debug::export($it, 5);
  28. $this->assertContains('foobar', $var->__STORAGE__);
  29. }
  30. }