Skip to content
This repository has been archived by the owner on Jan 25, 2023. It is now read-only.

Fix tests #71

Merged
merged 10 commits into from
Nov 22, 2017
Merged
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
7 changes: 5 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
language: php

php:
- 5.3
- 5.4
- 5.5
- 5.6
- 7.0
- 7.1
- hhvm

sudo: false
Expand All @@ -19,13 +19,16 @@ matrix:
include:
- php: 5.3
env: COMPOSER_FLAGS="--prefer-lowest" SYMFONY_DEPRECATIONS_HELPER=weak
dist: precise
- php: 5.6
env: SYMFONY_VERSION='2.8.*'
- php: 7.1
env: SYMFONY_VERSION='^3.0'

before_install:
- composer self-update
- if [ "$SYMFONY_VERSION" != "" ]; then composer require --dev symfony/framework-bundle:${SYMFONY_VERSION} --no-update; fi

install: composer update $COMPOSER_FLAGS

script: phpunit
script: ./vendor/bin/phpunit
17 changes: 13 additions & 4 deletions Tests/EventListener/MaintenanceListenerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\HttpKernel\Kernel;

/**
* Test for the maintenance listener
Expand Down Expand Up @@ -337,10 +338,18 @@ protected function getDatabaseDriver($lock = false)
*/
public function getTranslator()
{
$translator = new Translator(
$this->container,
$this->getMock('Symfony\Component\Translation\MessageSelector')
);
if (Kernel::VERSION_ID < 30300) {
$translator = new Translator(
$this->container,
$this->getMock('Symfony\Component\Translation\MessageSelector')
);
} else {
$translator = new Translator(
$this->container,
$this->getMock('Symfony\Component\Translation\MessageSelector'),
'en'
);
}

return $translator;
}
Expand Down
17 changes: 13 additions & 4 deletions Tests/Maintenance/DriverFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Bundle\FrameworkBundle\Translation\Translator;
use Lexik\Bundle\MaintenanceBundle\Drivers\DriverFactory;
use Symfony\Component\HttpKernel\Kernel;

/**
* Test driver factory
Expand Down Expand Up @@ -101,10 +102,18 @@ protected function getDatabaseDriver()

public function getTranslator()
{
$translator = new Translator(
$this->container,
$this->getMock('Symfony\Component\Translation\MessageSelector')
);
if (Kernel::VERSION_ID < 30300) {
$translator = new Translator(
$this->container,
$this->getMock('Symfony\Component\Translation\MessageSelector')
);
} else {
$translator = new Translator(
$this->container,
$this->getMock('Symfony\Component\Translation\MessageSelector'),
'en'
);
}

return $translator;
}
Expand Down
21 changes: 15 additions & 6 deletions Tests/Maintenance/FileMaintenanceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,20 @@
use Symfony\Bundle\FrameworkBundle\Translation\Translator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
use Symfony\Component\HttpKernel\Kernel;

/**
* Test driver file
*
* @package LexikMaintenanceBundle
* @author Gilles Gauthier <g.gauthier@lexik.fr>
*/
class FileDriverTest extends TestCase
class FileMaintenanceTest extends TestCase
{
static protected $tmpDir;
protected $container;

static public function setUpBeforeClass()
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();

Expand Down Expand Up @@ -134,10 +135,18 @@ protected function initContainer()

public function getTranslator()
{
$translator = new Translator(
$this->container,
$this->getMock('Symfony\Component\Translation\MessageSelector')
);
if (Kernel::VERSION_ID < 30300) {
$translator = new Translator(
$this->container,
$this->getMock('Symfony\Component\Translation\MessageSelector')
);
} else {
$translator = new Translator(
$this->container,
$this->getMock('Symfony\Component\Translation\MessageSelector'),
'en'
);
}

return $translator;
}
Expand Down
8 changes: 5 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@
}
],
"require": {
"php": ">=5.3.2",
"symfony/framework-bundle": "~2.7|~3.0"
"php": ">=5.3.9",
"symfony/framework-bundle": "~2.7|~3.0",
"symfony/translation": "~2.7|~3.0"
},
"require-dev": {
"symfony/phpunit-bridge": "~2.7|~3.0"
"symfony/phpunit-bridge": "~2.7|~3.0",
"phpunit/phpunit": "~4.8"
},
"autoload": {
"psr-4": { "Lexik\\Bundle\\MaintenanceBundle\\": "" }
Expand Down