Vendor update && Started using DoctrineMigrations

This commit is contained in:
Polonkai Gergely
2012-07-23 17:09:03 +02:00
parent 7c36f93436
commit bf46316347
1102 changed files with 103189 additions and 7 deletions

View File

@@ -0,0 +1,37 @@
<?php
namespace Metadata\Tests\Driver;
use Metadata\ClassMetadata;
use Metadata\Driver\DriverChain;
class DriverChainTest extends \PHPUnit_Framework_TestCase
{
public function testLoadMetadataForClass()
{
$driver = $this->getMock('Metadata\\Driver\\DriverInterface');
$driver
->expects($this->once())
->method('loadMetadataForClass')
->will($this->returnValue($metadata = new ClassMetadata('\stdClass')))
;
$chain = new DriverChain(array($driver));
$this->assertSame($metadata, $chain->loadMetadataForClass(new \ReflectionClass('\stdClass')));
}
public function testLoadMetadataForClassReturnsNullWhenNoMetadataIsFound()
{
$driver = new DriverChain(array());
$this->assertNull($driver->loadMetadataForClass(new \ReflectionClass('\stdClass')));
$driver = $this->getMock('Metadata\\Driver\\DriverInterface');
$driver
->expects($this->once())
->method('loadMetadataForClass')
->will($this->returnValue(null))
;
$driverChain = new DriverChain(array($driver));
$this->assertNull($driver->loadMetadataForClass(new \ReflectionClass('\stdClass')));
}
}

View File

@@ -0,0 +1,26 @@
<?php
namespace Metadata\Tests\Driver;
use Metadata\Driver\FileLocator;
class FileLocatorTest extends \PHPUnit_Framework_TestCase
{
public function testFindFileForClass()
{
$locator = new FileLocator(array(
'Metadata\Tests\Driver\Fixture\A' => __DIR__.'/Fixture/A',
'Metadata\Tests\Driver\Fixture\B' => __DIR__.'/Fixture/B',
'Metadata\Tests\Driver\Fixture\C' => __DIR__.'/Fixture/C',
));
$ref = new \ReflectionClass('Metadata\Tests\Driver\Fixture\A\A');
$this->assertEquals(realpath(__DIR__.'/Fixture/A/A.xml'), realpath($locator->findFileForClass($ref, 'xml')));
$ref = new \ReflectionClass('Metadata\Tests\Driver\Fixture\B\B');
$this->assertNull($locator->findFileForClass($ref, 'xml'));
$ref = new \ReflectionClass('Metadata\Tests\Driver\Fixture\C\SubDir\C');
$this->assertEquals(realpath(__DIR__.'/Fixture/C/SubDir.C.yml'), realpath($locator->findFileForClass($ref, 'yml')));
}
}

View File

@@ -0,0 +1,5 @@
<?php
namespace Metadata\Tests\Driver\Fixture\A;
class A {}

View File

@@ -0,0 +1,5 @@
<?php
namespace Metadata\Tests\Driver\Fixture\B;
class B { }

View File

@@ -0,0 +1,5 @@
<?php
namespace Metadata\Tests\Driver\Fixture\C\SubDir;
class C { }