diff --git a/composer.json b/composer.json index 9a84e9494..df2dd6867 100644 --- a/composer.json +++ b/composer.json @@ -13,7 +13,7 @@ "minimum-stability": "dev", "require": { "php": ">=5.3.3", - "doctrine/common": "~2.4.0", + "doctrine/common": "~2.4", "phpcr/phpcr": "~2.1.1", "phpcr/phpcr-implementation": "~2.1.0", "phpcr/phpcr-utils": "~1.1", @@ -21,6 +21,7 @@ }, "require-dev": { "symfony/yaml": "~2.0", + "symfony/phpunit-bridge": "2.7.*@dev", "liip/rmt": "~1.1" }, "suggest":{ diff --git a/lib/Doctrine/ODM/PHPCR/Mapping/Driver/YamlDriver.php b/lib/Doctrine/ODM/PHPCR/Mapping/Driver/YamlDriver.php index 613d4fe68..239e4b111 100644 --- a/lib/Doctrine/ODM/PHPCR/Mapping/Driver/YamlDriver.php +++ b/lib/Doctrine/ODM/PHPCR/Mapping/Driver/YamlDriver.php @@ -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; @@ -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)); } /** diff --git a/tests/bootstrap.php b/tests/bootstrap.php index fa64fc6d3..ae9ed5c61 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -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');