Skip to content

Commit

Permalink
[DCOM-204] Fix include of entities inside PHAR.
Browse files Browse the repository at this point in the history
  • Loading branch information
beberlei committed Feb 3, 2014
1 parent dcb25b3 commit dc1655b
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,11 @@ public function getAllClassNames()
);

foreach ($iterator as $file) {
$sourceFile = realpath($file[0]);
$sourceFile = $file[0];

if ( ! preg_match('(^phar:)i', $sourceFile)) {
$sourceFile = realpath($sourceFile);
}

foreach ($this->excludePaths as $excludePath) {
$exclude = str_replace('\\', '/', realpath($excludePath));
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

namespace Doctrine\Tests\Common\Persistence\Mapping;

use Doctrine\Common\Annotations\AnnotationReader;
use Doctrine\Common\Persistence\Mapping\Driver\AnnotationDriver;
use Doctrine\Common\Persistence\Mapping\ClassMetadata;

class AnnotationDriverTest extends \PHPUnit_Framework_TestCase
{
public function testGetAllClassNames()
{
$reader = new AnnotationReader();
$driver = new SimpleAnnotationDriver($reader, array(__DIR__ . '/_files/annotation'));

$classes = $driver->getAllClassNames();

$this->assertEquals(array('Doctrine\TestClass'), $classes);
}
}

class SimpleAnnotationDriver extends AnnotationDriver
{
protected $entityAnnotationClasses = array('Doctrine\Entity' => true);

public function loadMetadataForClass($className, ClassMetadata $metadata)
{
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

namespace Doctrine;

/**
* @Doctrine\Entity
*/
class TestClass
{
}

/**
* @Annotation
*/
class Entity
{
}

0 comments on commit dc1655b

Please sign in to comment.