Skip to content

Commit

Permalink
use symfony bridge to avoid deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
dbu committed Apr 5, 2015
1 parent 8b61902 commit 25ecf64
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
},
"require-dev": {
"symfony/yaml": "~2.0",
"symfony/phpunit-bridge": "2.7.*@dev",
"liip/rmt": "dev-master"
},
"suggest":{
Expand Down
6 changes: 5 additions & 1 deletion lib/Doctrine/ODM/PHPCR/Mapping/Driver/YamlDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

use Doctrine\Common\Persistence\Mapping\Driver\FileDriver;
use Doctrine\Common\Persistence\Mapping\ClassMetadata;
use Doctrine\ODM\PHPCR\Exception\InvalidArgumentException;
use Doctrine\ODM\PHPCR\Mapping\MappingException;
use Doctrine\Common\Persistence\Mapping\MappingException as DoctrineMappingException;
use Symfony\Component\Yaml\Yaml;
Expand Down Expand Up @@ -270,7 +271,10 @@ private function addMappingFromReference(ClassMetadata $class, $fieldName, $refe
*/
protected function loadMappingFile($file)
{
return Yaml::parse($file);
if (!is_file($file)) {
throw new InvalidArgumentException(sprintf('File "%s" not found', $file));
}
return Yaml::parse(file_get_contents($file));
}

/**
Expand Down
8 changes: 8 additions & 0 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@
throw new RuntimeException('Install dependencies to run test suite.');
}

$files = array_filter(array(
__DIR__.'/../vendor/symfony/symfony/src/Symfony/Bridge/PhpUnit/bootstrap.php',
__DIR__.'/../vendor/symfony/phpunit-bridge/bootstrap.php',
), 'file_exists');
if ($files) {
require_once current($files);
}

use Doctrine\Common\Annotations\AnnotationRegistry;
AnnotationRegistry::registerLoader(array($autoload, 'loadClass'));
AnnotationRegistry::registerFile(__DIR__.'/../lib/Doctrine/ODM/PHPCR/Mapping/Annotations/DoctrineAnnotations.php');
Expand Down

0 comments on commit 25ecf64

Please sign in to comment.