You are here

class DebugTest in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/doctrine/common/tests/Doctrine/Tests/Common/Util/DebugTest.php \Doctrine\Tests\Common\Util\DebugTest

Hierarchy

  • class \Doctrine\Tests\Common\Util\DebugTest extends \Doctrine\Tests\DoctrineTestCase

Expanded class hierarchy of DebugTest

File

vendor/doctrine/common/tests/Doctrine/Tests/Common/Util/DebugTest.php, line 8

Namespace

Doctrine\Tests\Common\Util
View source
class DebugTest extends DoctrineTestCase {
  public function testExportObject() {
    $obj = new \stdClass();
    $obj->foo = "bar";
    $obj->bar = 1234;
    $var = Debug::export($obj, 2);
    $this
      ->assertEquals("stdClass", $var->__CLASS__);
  }
  public function testExportDateTime() {
    $obj = new \DateTime("2010-10-10 10:10:10");
    $var = Debug::export($obj, 2);
    $this
      ->assertEquals("DateTime", $var->__CLASS__);
  }
  public function testExportArrayTraversable() {
    $obj = new \ArrayObject(array(
      'foobar',
    ));
    $var = Debug::export($obj, 2);
    $this
      ->assertContains('foobar', $var->__STORAGE__);
    $it = new \ArrayIterator(array(
      'foobar',
    ));
    $var = Debug::export($it, 5);
    $this
      ->assertContains('foobar', $var->__STORAGE__);
  }
  public function testReturnsOutput() {
    ob_start();
    $dump = Debug::dump('foo');
    $outputValue = ob_get_contents();
    ob_end_clean();
    $this
      ->assertSame($outputValue, $dump);
  }
  public function testDisablesOutput() {
    ob_start();
    $dump = Debug::dump('foo', 2, true, false);
    $outputValue = ob_get_contents();
    ob_end_clean();
    $this
      ->assertEmpty($outputValue);
    $this
      ->assertNotSame($outputValue, $dump);
  }

}

Members