merged 2.0
This commit is contained in:
commit
5803146a9e
@ -100,6 +100,6 @@ class EntityUserProvider implements UserProviderInterface
|
||||
*/
|
||||
public function supportsClass($class)
|
||||
{
|
||||
return $class === $this->class;
|
||||
return $class === $this->class || is_subclass_of($class, $this->class);
|
||||
}
|
||||
}
|
||||
|
@ -77,12 +77,12 @@ class MetadataFactory
|
||||
if (class_exists($class)) {
|
||||
$r = $all[0]->getReflectionClass();
|
||||
$path = $this->getBasePathForClass($class, $r->getNamespacename(), dirname($r->getFilename()));
|
||||
$metadata->setNamespace($r->getNamespacename());
|
||||
} elseif (!$path) {
|
||||
throw new \RuntimeException(sprintf('Unable to determine where to save the "%s" class (use the --path option).', $class));
|
||||
}
|
||||
|
||||
$metadata->setPath($path);
|
||||
$metadata->setNamespace($r->getNamespacename());
|
||||
|
||||
return $metadata;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
<!-- START of Symfony2 Web Debug Toolbar -->
|
||||
{% if position != 'normal' %}
|
||||
{% if 'normal' != position %}
|
||||
<div style="clear: both; height: 40px;"></div>
|
||||
{% endif %}
|
||||
|
||||
|
@ -75,6 +75,23 @@ class EntityUserProviderTest extends DoctrineOrmTestCase
|
||||
$provider->refreshUser($user2);
|
||||
}
|
||||
|
||||
public function testSupportProxy()
|
||||
{
|
||||
$em = $this->createTestEntityManager();
|
||||
$this->createSchema($em);
|
||||
|
||||
$user1 = new CompositeIdentEntity(1, 1, 'user1');
|
||||
|
||||
$em->persist($user1);
|
||||
$em->flush();
|
||||
$em->clear();
|
||||
|
||||
$provider = new EntityUserProvider($em, 'Symfony\Tests\Bridge\Doctrine\Fixtures\CompositeIdentEntity', 'name');
|
||||
|
||||
$user2 = $em->getReference('Symfony\Tests\Bridge\Doctrine\Fixtures\CompositeIdentEntity', array('id1' => 1, 'id2' => 1));
|
||||
$this->assertTrue($provider->supportsClass(get_class($user2)));
|
||||
}
|
||||
|
||||
private function createSchema($em)
|
||||
{
|
||||
$schemaTool = new SchemaTool($em);
|
||||
|
@ -23,6 +23,10 @@ class PhpExecutableFinderTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testFindWithPHP_PATH()
|
||||
{
|
||||
if (defined('PHP_BINARY')) {
|
||||
$this->markTestSkipped('The PHP binary is easily available as of PHP 5.4');
|
||||
}
|
||||
|
||||
$f = new PhpExecutableFinder();
|
||||
|
||||
$current = $f->find();
|
||||
@ -41,6 +45,10 @@ class PhpExecutableFinderTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testFindWithSuffix()
|
||||
{
|
||||
if (defined('PHP_BINARY')) {
|
||||
$this->markTestSkipped('The PHP binary is easily available as of PHP 5.4');
|
||||
}
|
||||
|
||||
putenv('PHP_PATH=');
|
||||
putenv('PHP_PEAR_PHP_BIN=');
|
||||
$f = new PhpExecutableFinder();
|
||||
|
Reference in New Issue
Block a user