Update to drupal 8.0.0-rc1. For more information, see https://www.drupal.org/node/2582663

This commit is contained in:
Greg Anderson 2015-10-08 11:40:12 -07:00
parent eb34d130a8
commit f32e58e4b1
8476 changed files with 211648 additions and 170042 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,65 @@
<?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__ );
}
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);
}
}