Skip to content

Commit c81e60a

Browse files
author
Cédric Girard
committed
use composer to load test lib, and run test with SF 2.3 and 2.4
1 parent 3c0e234 commit c81e60a

7 files changed

+27
-121
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ phpunit.xml
44
.buildpath
55
.settings
66
vendor
7+
composer.lock

.travis.yml

+9-4
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,15 @@ php:
44
- 5.3
55

66
env:
7-
- SYMFONY_VERSION=v2.2
8-
- SYMFONY_VERSION=v2.3
7+
- SYMFONY_VERSION=2.3.* DOCTRINE_ORM_VERSION=2.4.* DOCTRINE_BUNDLE_VERSION=1.2.*
8+
- SYMFONY_VERSION=2.4.* DOCTRINE_ORM_VERSION=2.4.* DOCTRINE_BUNDLE_VERSION=1.2.*
99

10-
before_script:
11-
- php Tests/vendors.php
10+
before_script:
11+
- composer require symfony/framework-bundle:${SYMFONY_VERSION} --no-update
12+
- composer require doctrine/doctrine-bundle:${DOCTRINE_BUNDLE_VERSION} --no-update
13+
- composer require doctrine/orm:${DOCTRINE_ORM_VERSION} --no-update
14+
- composer require doctrine/data-fixtures:1.0.*
15+
- composer require twig/twig:1.15.*
16+
- composer update --dev
1217

1318
script: phpunit

Tests/Unit/BaseUnitTestCase.php

+5-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
use Lexik\Bundle\CurrencyBundle\Tests\Fixtures\CurrencyData;
66

77
use Doctrine\ORM\EntityManager;
8-
use Doctrine\ORM\Mapping\DefaultQuoteStrategy;
98
use Doctrine\Common\DataFixtures\Executor\ORMExecutor;
109
use Doctrine\Common\DataFixtures\Purger\ORMPurger;
1110
use Doctrine\Common\Annotations\AnnotationReader;
@@ -81,10 +80,13 @@ protected function getMockSqliteEntityManager()
8180
->will($this->returnValue('Doctrine\ORM\Mapping\ClassMetadataFactory'));
8281
$config->expects($this->any())
8382
->method('getDefaultRepositoryClassName')
84-
->will($this->returnValue('Doctrine\\ORM\\EntityRepository'));
83+
->will($this->returnValue('Doctrine\ORM\EntityRepository'));
84+
$config->expects($this->any())
85+
->method('getRepositoryFactory')
86+
->will($this->returnValue(new \Doctrine\ORM\Repository\DefaultRepositoryFactory()));
8587
$config->expects($this->any())
8688
->method('getQuoteStrategy')
87-
->will($this->returnValue(new DefaultQuoteStrategy()));
89+
->will($this->returnValue(new \Doctrine\ORM\Mapping\DefaultQuoteStrategy()));
8890

8991
$conn = array(
9092
'driver' => 'pdo_sqlite',

Tests/autoload.php.dist

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
if (!$loader = include __DIR__.'/../vendor/autoload.php') {
4+
$nl = PHP_SAPI === 'cli' ? PHP_EOL : '<br />';
5+
echo "$nl$nl";
6+
die('You must set up the project dependencies.'.$nl.
7+
'Run the following commands in '.dirname(__DIR__).':'.$nl.$nl.
8+
'curl -s http://getcomposer.org/installer | php'.$nl.
9+
'php composer.phar install'.$nl);
10+
}

Tests/bootstrap.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

3-
if (file_exists($file = __DIR__.'/../autoload.php')) {
3+
if (file_exists($file = __DIR__.'/autoload.php')) {
44
require_once $file;
5-
} elseif (file_exists($file = __DIR__.'/../autoload.php.dist')) {
5+
} elseif (file_exists($file = __DIR__.'/autoload.php.dist')) {
66
require_once $file;
77
}

Tests/vendors.php

-68
This file was deleted.

autoload.php.dist

-44
This file was deleted.

0 commit comments

Comments
 (0)