Initial import.

This commit is contained in:
ekes 2015-02-24 16:25:12 +01:00
commit 86383280c9
428 changed files with 68738 additions and 0 deletions

View file

@ -0,0 +1,100 @@
<?php
namespace Doctrine\Tests\Common\Util
{
use Doctrine\Tests\DoctrineTestCase;
use Doctrine\Common\Util\ClassUtils;
class ClassUtilsTest extends DoctrineTestCase
{
static public function dataGetClass()
{
return array(
array('stdClass', 'stdClass'),
array('Doctrine\Common\Util\ClassUtils', 'Doctrine\Common\Util\ClassUtils'),
array( 'MyProject\Proxies\__CG__\stdClass', 'stdClass' ),
array( 'MyProject\Proxies\__CG__\OtherProject\Proxies\__CG__\stdClass', 'stdClass' ),
array( 'MyProject\Proxies\__CG__\Doctrine\Tests\Common\Util\ChildObject','Doctrine\Tests\Common\Util\ChildObject' )
);
}
/**
* @dataProvider dataGetClass
*/
public function testGetRealClass($className, $expectedClassName)
{
$this->assertEquals($expectedClassName, ClassUtils::getRealClass($className));
}
/**
* @dataProvider dataGetClass
*/
public function testGetClass( $className, $expectedClassName )
{
$object = new $className();
$this->assertEquals($expectedClassName, ClassUtils::getClass($object));
}
public function testGetParentClass()
{
$parentClass = ClassUtils::getParentClass( 'MyProject\Proxies\__CG__\OtherProject\Proxies\__CG__\Doctrine\Tests\Common\Util\ChildObject' );
$this->assertEquals('stdClass', $parentClass);
}
public function testGenerateProxyClassName()
{
$this->assertEquals( 'Proxies\__CG__\stdClass', ClassUtils::generateProxyClassName( 'stdClass', 'Proxies' ) );
}
/**
* @dataProvider dataGetClass
*/
public function testNewReflectionClass( $className, $expectedClassName )
{
$reflClass = ClassUtils::newReflectionClass( $className );
$this->assertEquals( $expectedClassName, $reflClass->getName() );
}
/**
* @dataProvider dataGetClass
*/
public function testNewReflectionObject( $className, $expectedClassName )
{
$object = new $className;
$reflClass = ClassUtils::newReflectionObject( $object );
$this->assertEquals( $expectedClassName, $reflClass->getName() );
}
}
class ChildObject extends \stdClass
{
}
}
namespace MyProject\Proxies\__CG__
{
class stdClass extends \stdClass
{
}
}
namespace MyProject\Proxies\__CG__\Doctrine\Tests\Common\Util
{
class ChildObject extends \Doctrine\Tests\Common\Util\ChildObject
{
}
}
namespace MyProject\Proxies\__CG__\OtherProject\Proxies\__CG__
{
class stdClass extends \MyProject\Proxies\__CG__\stdClass
{
}
}
namespace MyProject\Proxies\__CG__\OtherProject\Proxies\__CG__\Doctrine\Tests\Common\Util
{
class ChildObject extends \MyProject\Proxies\__CG__\Doctrine\Tests\Common\Util\ChildObject
{
}
}

View file

@ -0,0 +1,27 @@
<?php
namespace Doctrine\Tests\Common\Util;
use Doctrine\Tests\DoctrineTestCase;
use Doctrine\Common\Util\Debug;
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__ );
}
}