Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upgrade to sf 2.5 #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Loader/AbstractLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Lexik\Bundle\FixturesMapperBundle\Loader;

use Symfony\Component\Validator\Validator;
use Symfony\Component\Validator\Validator\ValidatorInterface;

/**
* Base loader class for fixtures.
Expand Down Expand Up @@ -40,11 +40,11 @@ abstract class AbstractLoader
* Constructor.
*
* @param EntityManager $entityManager
* @param Validator $validator
* @param ValidatorInterface $validator
* @param string $mapperClass
* @param string $mapperCollectionDelimiter
*/
public function __construct($entityManager, array $adapters, Validator $validator, $mapperClass, $mapperCollectionDelimiter)
public function __construct($entityManager, array $adapters, ValidatorInterface $validator, $mapperClass, $mapperCollectionDelimiter)
{
$this->adapters = $adapters;
$this->validator = $validator;
Expand Down
6 changes: 3 additions & 3 deletions Mapper/Mapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use Lexik\Bundle\FixturesMapperBundle\Adapter\EntityManagerAdapterInterface;
use Lexik\Bundle\FixturesMapperBundle\Exception\InvalidMethodException;

use Symfony\Component\Validator\Validator;
use Symfony\Component\Validator\Validator\ValidatorInterface;
use Symfony\Component\DependencyInjection\Container;

/**
Expand Down Expand Up @@ -94,9 +94,9 @@ class Mapper implements MapperInterface
*
* @param array $values
* @param EntityManagerAdapterInterface $entityManager
* @param Validator $validator
* @param ValidatorInterface $validator
*/
public function __construct(array $values, EntityManagerAdapterInterface $entityManager, Validator $validator, $collectionDelimiter)
public function __construct(array $values, EntityManagerAdapterInterface $entityManager, ValidatorInterface $validator, $collectionDelimiter)
{
$this->values = $values;
$this->entityManager = $entityManager;
Expand Down
4 changes: 3 additions & 1 deletion Tests/Loader/CsvLoaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Lexik\Bundle\FixturesMapperBundle\Loader\CsvLoader;
use Lexik\Bundle\FixturesMapperBundle\Mapper\Mapper;

use Symfony\Component\Validator\Validation;
use Symfony\Component\Validator\ValidatorFactory;

class CsvLoaderTest extends TestCase
Expand All @@ -23,7 +24,8 @@ protected function setUp()
),
);

$validator = ValidatorFactory::buildDefault(array(), true)->getValidator();
$validator = Validation::createValidatorBuilder()
->getValidator();
$this->csvLoader = new CsvLoader($this->getMockSqliteEntityManager(), $adapters, $validator, 'Lexik\Bundle\FixturesMapperBundle\Mapper\Mapper', '|');
}

Expand Down
5 changes: 3 additions & 2 deletions Tests/Loader/YamlLoaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use Lexik\Bundle\FixturesMapperBundle\Loader\YamlLoader;
use Lexik\Bundle\FixturesMapperBundle\Mapper\Mapper;

use Symfony\Component\Validator\ValidatorFactory;
use Symfony\Component\Validator\Validation;

class YamlLoaderTest extends TestCase
{
Expand All @@ -23,7 +23,8 @@ protected function setUp()
),
);

$validator = ValidatorFactory::buildDefault(array(), true)->getValidator();
$validator = Validation::createValidatorBuilder()
->getValidator();

$this->yamlLoader = new YamlLoader($this->getMockSqliteEntityManager(), $adapters, $validator, 'Lexik\Bundle\FixturesMapperBundle\Mapper\Mapper', '|');
}
Expand Down
8 changes: 5 additions & 3 deletions Tests/Mapper/MapperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
use Lexik\Bundle\FixturesMapperBundle\Loader\YamlLoader;
use Lexik\Bundle\FixturesMapperBundle\Mapper\Mapper;

use Symfony\Component\Validator\ValidatorFactory;
use Symfony\Component\Validator\Validation;
use Doctrine\DBAL\DBALException;

class MapperTest extends TestCase
{
Expand All @@ -31,7 +32,8 @@ protected function setUp()
),
);

$this->validator = ValidatorFactory::buildDefault(array(), true)->getValidator();
$this->validator = Validation::createValidatorBuilder()
->getValidator();

$this->csvLoader = new CsvLoader($this->em, $adapters, $this->validator, 'Lexik\Bundle\FixturesMapperBundle\Mapper\Mapper', '|');
$this->yamlLoader = new YamlLoader($this->em, $adapters, $this->validator, 'Lexik\Bundle\FixturesMapperBundle\Mapper\Mapper', '|');
Expand Down Expand Up @@ -92,7 +94,7 @@ public function testFromYaml()
}

/**
* @expectedException PDOException
* @expectedException Doctrine\DBAL\DBALException
* @expectedExceptionMessage Article.title may not be NULL
*/
public function testFromYamlIncompleteMapping()
Expand Down
15 changes: 12 additions & 3 deletions Tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Lexik\Bundle\FixturesMapperBundle\Tests;

use Doctrine\ORM\Repository\DefaultRepositoryFactory;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Doctrine\Common\Annotations\AnnotationReader;
use Doctrine\ORM\EntityManager;
Expand Down Expand Up @@ -54,7 +55,6 @@ protected function getMockSqliteEntityManager()

$reader = new AnnotationReader();
$mappingDriver = new AnnotationDriverORM($reader, array(
__DIR__.'/../vendor/doctrine/lib',
__DIR__.'/Fixture/Entity',
));

Expand All @@ -79,10 +79,19 @@ protected function getMockSqliteEntityManager()
->method('getMetadataDriverImpl')
->will($this->returnValue($mappingDriver));

$config->expects($this->any())
->method('getDefaultRepositoryClassName')
$config->expects($this->any())
->method('getDefaultRepositoryClassName')
->will($this->returnValue('Doctrine\\ORM\\EntityRepository'));

$config->expects($this->any())
->method('getQuoteStrategy')
->will($this->returnValue( new Mapping\DefaultQuoteStrategy()));


$config->expects($this->any())
->method('getRepositoryFactory')
->will($this->returnValue( new DefaultRepositoryFactory()));

$evm = $this->getMock('Doctrine\Common\EventManager');
$em = \Doctrine\ORM\EntityManager::create($conn, $config, $evm);

Expand Down
10 changes: 5 additions & 5 deletions autoload.php.dist
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

require_once __DIR__.'/vendor/symfony/src/Symfony/Component/ClassLoader/UniversalClassLoader.php';
require_once __DIR__.'/vendor/autoload.php';

use Symfony\Component\ClassLoader\UniversalClassLoader;
use Doctrine\Common\Annotations\AnnotationRegistry;
Expand All @@ -16,13 +16,13 @@ $loader->registerNamespaces(array(
));

if (!function_exists('intl_get_error_code')) {
require_once __DIR__.'/vendor/symfony/src/Symfony/Component/Locale/Resources/stubs/functions.php';

$loader->registerPrefixFallbacks(array(__DIR__.'/vendor/symfony/src/Symfony/Component/Locale/Resources/stubs'));
require_once __DIR__.'/vendor/symfony/symfony/src/Symfony/Component/Intl/Resources/stubs/functions.php';
$loader->registerPrefixFallbacks(array(__DIR__.'/vendor/symfony/symfony/src/Symfony/Component/Locale/Resources/stubs'));
}
$loader->register();

AnnotationRegistry::registerFile(__DIR__.'/vendor/doctrine/lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php');
AnnotationRegistry::registerFile(__DIR__.'/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php');

spl_autoload_register(function($class) {
$class = ltrim($class, '\\');
Expand All @@ -32,4 +32,4 @@ spl_autoload_register(function($class) {
require $file;
}
}
});
});
10 changes: 6 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@
],
"require": {
"php": ">=5.3.2",
"symfony/symfony": "~2.1"
"symfony/symfony": "~2.5"
},
"suggest": {
"doctrine/data-fixtures": "*",
"doctrine/orm": "*"
"require-dev": {
"phpunit/phpunit": "3.7.*",
"doctrine/data-fixtures": "*",
"doctrine/orm": "*"

},
"autoload": {
"psr-0": { "Lexik\\Bundle\\FixturesMapperBundle": "" }
Expand Down