mirror of
https://github.com/retailcrm/NelmioApiDocBundle.git
synced 2025-02-02 07:41:43 +03:00
Fix tests for Symfony2 2.1
This commit is contained in:
parent
a2d8629f68
commit
e59ae1e1ef
@ -6,9 +6,9 @@ php:
|
||||
- 5.5
|
||||
|
||||
env:
|
||||
- SYMFONY_VERSION=~2.1.0
|
||||
- SYMFONY_VERSION=~2.2.0
|
||||
- SYMFONY_VERSION=~2.3.0
|
||||
- SYMFONY_VERSION=2.1.*
|
||||
- SYMFONY_VERSION=2.2.*
|
||||
- SYMFONY_VERSION=2.3.*
|
||||
- SYMFONY_VERSION=dev-master
|
||||
|
||||
matrix:
|
||||
@ -18,6 +18,8 @@ matrix:
|
||||
before_script:
|
||||
- composer self-update
|
||||
- composer require symfony/framework-bundle:${SYMFONY_VERSION} --no-update
|
||||
- composer require symfony/twig-bundle:${SYMFONY_VERSION} --no-update
|
||||
- composer require symfony/validator:${SYMFONY_VERSION} --no-update
|
||||
- composer update
|
||||
|
||||
script: phpunit --coverage-text
|
||||
|
@ -65,7 +65,7 @@ class ValidationParserLegacy extends ValidationParser
|
||||
$constraints = $propdata->getConstraints();
|
||||
|
||||
foreach ($constraints as $constraint) {
|
||||
$vparams = $this->parseConstraint($constraint, $vparams);
|
||||
$vparams = $this->parseConstraint($constraint, $vparams, $className);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,8 @@ namespace NelmioApiDocBundle\Tests\Parser;
|
||||
|
||||
use Nelmio\ApiDocBundle\Tests\WebTestCase;
|
||||
use Nelmio\ApiDocBundle\Parser\ValidationParser;
|
||||
use Nelmio\ApiDocBundle\Parser\ValidationParserLegacy;
|
||||
use Symfony\Component\HttpKernel\Kernel;
|
||||
|
||||
class ValidationParserTest extends WebTestCase
|
||||
{
|
||||
@ -13,7 +15,11 @@ class ValidationParserTest extends WebTestCase
|
||||
$container = $this->getContainer();
|
||||
$factory = $container->get('validator.mapping.class_metadata_factory');
|
||||
|
||||
$this->parser = new ValidationParser($factory);
|
||||
if (version_compare(Kernel::VERSION, '2.2.0', '<')) {
|
||||
$this->parser = new ValidationParserLegacy($factory);
|
||||
} else {
|
||||
$this->parser = new ValidationParser($factory);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -17,6 +17,17 @@ use Symfony\Component\HttpKernel\Kernel;
|
||||
|
||||
abstract class WebTestCase extends BaseWebTestCase
|
||||
{
|
||||
protected function setUp()
|
||||
{
|
||||
$this->deleteTmpDir();
|
||||
|
||||
parent::setUp();
|
||||
|
||||
if (version_compare(Kernel::VERSION, '2.2.0', '<')) {
|
||||
$this->markTestSkipped('Does not work with Symfony2 2.1 due to a "host" parameter in the `routing.yml` file');
|
||||
}
|
||||
}
|
||||
|
||||
protected function deleteTmpDir()
|
||||
{
|
||||
if (!file_exists($dir = sys_get_temp_dir().'/'.Kernel::VERSION)) {
|
||||
@ -63,12 +74,6 @@ abstract class WebTestCase extends BaseWebTestCase
|
||||
);
|
||||
}
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$this->deleteTmpDir();
|
||||
parent::setUp();
|
||||
}
|
||||
|
||||
public function tearDown()
|
||||
{
|
||||
parent::tearDown();
|
||||
|
@ -15,10 +15,11 @@
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"symfony/framework-bundle": "~2.1",
|
||||
"symfony/twig-bundle": "~2.1",
|
||||
"symfony/framework-bundle": "2.1.*",
|
||||
"symfony/twig-bundle": "2.1.*",
|
||||
"symfony/console": "~2.1",
|
||||
"dflydev/markdown": "1.0.*"
|
||||
"dflydev/markdown": "1.0.*",
|
||||
"symfony/validator": "2.1.0"
|
||||
},
|
||||
"conflict": {
|
||||
"jms/serializer": "<0.12",
|
||||
|
Loading…
x
Reference in New Issue
Block a user