~ubuntu-branches/ubuntu/wily/php-doctrine-common/wily-proposed

« back to all changes in this revision

Viewing changes to tests/Doctrine/Tests/Common/Util/DebugTest.php

  • Committer: Package Import Robot
  • Author(s): David Prévot
  • Date: 2014-06-15 11:26:00 UTC
  • mfrom: (2.1.1 experimental)
  • Revision ID: package-import@ubuntu.com-20140615112600-sg4mgpwq9sfg4mre
Tags: 2.4.2-2
* Upload to unstable
* No tests if DEB_BUILD_OPTIONS contains nocheck

Show diffs side-by-side

added added

removed removed

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