Skip to content

Commit

Permalink
Merge pull request #379 from Soullivaneuh/dependencies-upgrade
Browse files Browse the repository at this point in the history
Dependencies upgrade
  • Loading branch information
alexislefebvre authored Jan 17, 2018
2 parents 369deb1 + 48ec7c6 commit 06782e5
Show file tree
Hide file tree
Showing 53 changed files with 612 additions and 558 deletions.
16 changes: 16 additions & 0 deletions .php_cs.dist
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
<?php

$header = <<<'HEADER'
This file is part of the Liip/FunctionalTestBundle
(c) Lukas Kahwe Smith <smith@pooteeweet.org>
This source file is subject to the MIT license that is bundled
with this source code in the file LICENSE.
HEADER;

$finder = PhpCsFixer\Finder::create()
->in(__DIR__)
->notPath('/cache/')
Expand All @@ -16,6 +25,9 @@ return PhpCsFixer\Config::create()
],
'combine_consecutive_issets' => true,
'combine_consecutive_unsets' => true,
'header_comment' => [
'header' => $header,
],
'no_extra_consecutive_blank_lines' => true,
'no_php4_constructor' => true,
'no_useless_else' => true,
Expand All @@ -24,6 +36,10 @@ return PhpCsFixer\Config::create()
'phpdoc_order' => true,
'@PHP56Migration' => true,
'@PHP56Migration:risky' => true,
'@PHP70Migration' => true,
'@PHP70Migration:risky' => true,
'@PHP71Migration' => true,
'@PHP71Migration:risky' => true,
'strict_comparison' => true,
'strict_param' => true,
'php_unit_strict' => true,
Expand Down
18 changes: 5 additions & 13 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ dist: trusty
language: php

php:
- 5.6
- 7.0
- 7.1
- 7.2

Expand All @@ -19,29 +17,23 @@ services:

matrix:
include:
- php: 5.6
env: COMPOSER_FLAGS="--prefer-lowest"
- php: 7.1
env: SYMFONY_VERSION="2.7.*"
- php: 7.1
env: SYMFONY_VERSION="2.8.*"
- php: 7.1
env: SYMFONY_VERSION="3.3.*"
- php: 7.1
env: SYMFONY_VERSION="3.4.*"
env: COMPOSER_FLAGS="--prefer-lowest"
- php: 7.2
env: SYMFONY_VERSION="3.4.*"
- php: 7.2
env: SYMFONY_VERSION="4.0.*"
- php: 7.2
env: EXTRA_PACKAGES="doctrine/phpcr-bundle:^1.3 brianium/paratest:^1.0 doctrine/phpcr-odm:^1.3"
allow_failures:
- php: 7.2
env: SYMFONY_VERSION="4.0.*"
env: SYMFONY_VERSION="dev-master"
fast_finish: true

before_install:
- if [[ $TRAVIS_PHP_VERSION != '7.0' && $TRAVIS_PHP_VERSION != '7.1' && $TRAVIS_PHP_VERSION != '7.2' ]]; then phpenv config-rm xdebug.ini; fi
- echo "memory_limit = -1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
- if [ "$SYMFONY_VERSION" != "" ]; then composer require --no-update symfony/symfony=$SYMFONY_VERSION; fi
- if [ "$EXTRA_PACKAGES" != "" ]; then composer require --no-update $EXTRA_PACKAGES; fi

install:
# use "update" instead of "install" since it allows using the "--prefer-lowest" option
Expand Down
12 changes: 7 additions & 5 deletions ExampleTests/ExampleFunctionalTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is part of the Liip/FunctionalTestBundle
*
Expand All @@ -23,7 +25,7 @@ class ExampleFunctionalTest extends WebTestCase
/**
* Example using LiipFunctionalBundle the fixture loader.
*/
public function testUserFooIndex()
public function testUserFooIndex(): void
{
$this->loadFixtures(['Liip\FooBundle\Tests\Fixtures\LoadUserData']);

Expand All @@ -37,7 +39,7 @@ public function testUserFooIndex()
/**
* Example using LiipFunctionalBundle WebTestCase helpers and with authentication.
*/
public function testBasicAuthentication()
public function testBasicAuthentication(): void
{
$this->loadFixtures(['Liip\FooBundle\Tests\Fixtures\LoadUserData']);

Expand All @@ -48,18 +50,18 @@ public function testBasicAuthentication()
$this->assertContains('logout', $content);
}

public function test404Page()
public function test404Page(): void
{
$this->fetchContent('/asdasdas', 'GET', false, false);
}

public function testLoginPage()
public function testLoginPage(): void
{
$content = $this->fetchContent('/', 'GET', false);
$this->assertContains('login', $content);
}

public function testValidationErrors()
public function testValidationErrors(): void
{
$client = $this->makeClient(true);
$crawler = $client->request('GET', '/users/1/edit');
Expand Down
4 changes: 3 additions & 1 deletion ExampleTests/ExampleUnitTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is part of the Liip/FunctionalTestBundle
*
Expand All @@ -23,7 +25,7 @@ class ExampleUnitTest extends WebTestCase
/**
* Example using LiipFunctionalBundle the service mock builder.
*/
public function testIndexAction()
public function testIndexAction(): void
{
$view = $this->getServiceMockBuilder('FooView')->getMock();

Expand Down
4 changes: 3 additions & 1 deletion ExampleTests/Fixtures/LoadUserData.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is part of the Liip/FunctionalTestBundle
*
Expand All @@ -21,7 +23,7 @@
*/
class LoadUserData implements FixtureInterface
{
public function load(ObjectManager $manager)
public function load(ObjectManager $manager): void
{
$user = new \Liip\FooBundle\Entity\User();
$user->setName('foo bar');
Expand Down
37 changes: 3 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -404,8 +404,9 @@ Tips for Fixture Loading Tests
If you would like to setup your fixtures with yml files using [Alice](https://github.com/nelmio/alice),
[`Liip\FunctionalTestBundle\Test\WebTestCase`](Test/WebTestCase.php) has a helper function `loadFixtureFiles`
which takes an array of resources, or paths to yml files, and returns an array of objects.
This method uses the [Alice Loader](https://github.com/nelmio/alice/blob/master/src/Nelmio/Alice/Fixtures/Loader.php)
rather than the FunctionalTestBundle's load methods. You should be aware that there are some difference between the ways these two libraries handle loading.
This method uses the [Theofidry AliceDataFixtures loader](https://github.com/theofidry/AliceDataFixtures#doctrine-orm)
rather than the FunctionalTestBundle's load methods.
You should be aware that there are some difference between the ways these two libraries handle loading.
```php
$fixtures = $this->loadFixtureFiles(array(
Expand Down Expand Up @@ -446,38 +447,6 @@ $files = array(
$fixtures = $this->loadFixtureFiles($files, true, null, 'doctrine', ORMPurger::PURGE_MODE_TRUNCATE );
```
#### HautelookAliceBundle Faker Providers
This bundle supports faker providers from HautelookAliceBundle.
Install the bundle with `composer require --dev hautelook/alice-bundle:~1.2` and use the
[HautelookAliceBundle documentation](https://github.com/hautelook/AliceBundle/blob/1.x/src/Resources/doc/faker-providers.md#faker-providers)
in order to define your faker providers.
You'll have to add the following line in the `app/AppKernel.php` file:
```php
<?php
// app/AppKernel.php
// ...
class AppKernel extends Kernel
{
public function registerBundles()
{
// ...
if (in_array($this->getEnvironment(), array('dev', 'test'))) {
$bundles[] = new Hautelook\AliceBundle\HautelookAliceBundle();
}
return $bundles;
}
// ...
}
```
Then you can load fixtures with `$this->loadFixtureFiles(array('@AcmeBundle/…/fixture.yml'));`.
### Non-SQLite
The Bundle will not automatically create your schema for you unless you use SQLite.
Expand Down
35 changes: 15 additions & 20 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,23 @@
}
],
"require": {
"php": "^5.6|^7.0",
"symfony/framework-bundle": "^2.7|^3.0|^4.0",
"symfony/browser-kit": "^2.7|^3.0|^4.0",
"doctrine/common": "~2.0"
"php": "^7.1",
"symfony/framework-bundle": "^3.4 || ^4.0",
"symfony/browser-kit": "^3.4 || ^4.0",
"doctrine/common": "^2.0"
},
"require-dev": {
"symfony/symfony": "^2.7.1|^3.3|^4.0",
"symfony/phpunit-bridge": "^2.7|^3.0|^4.0",
"doctrine/orm": "~2.5",
"symfony/console": "^2.7|^3.0|^4.0",
"symfony/assetic-bundle": "^2.7|^3.0|^4.0",
"symfony/monolog-bundle": "^2.7|^3.0|^4.0",
"doctrine/doctrine-fixtures-bundle": "~2.3",
"phpunit/phpunit": "^4.8.35|^5.7|^6.1",
"twig/twig": "~1.12|~2.0",
"nelmio/alice": "~1.7|~2.0",
"jackalope/jackalope-doctrine-dbal": "1.1.*|1.2.*",
"doctrine/phpcr-odm": "~1.3",
"doctrine/phpcr-bundle": "~1.3",
"hautelook/alice-bundle": "~0.2|~1.2",
"brianium/paratest": "~0.12.0|~0.13.2",
"doctrine/data-fixtures": "1.2.2"
"symfony/symfony": "^3.4 || ^4.0",
"symfony/phpunit-bridge": "^3.4 || ^4.0",
"doctrine/orm": "^2.5",
"symfony/monolog-bundle": "^3.1",
"doctrine/doctrine-fixtures-bundle": "^3.0",
"doctrine/doctrine-bundle": "^1.8",
"phpunit/phpunit": "^6.1",
"twig/twig": "^2.0",
"theofidry/alice-data-fixtures": "^1.0.1",
"jackalope/jackalope-doctrine-dbal": "^1.3",
"doctrine/data-fixtures": "^1.3"
},
"suggest": {
"symfony/framework-bundle": "To use assertStatusCode and assertValidationErrors ~2.5",
Expand Down
2 changes: 1 addition & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
>

<php>
<server name="KERNEL_DIR" value="tests/App" />
<server name="KERNEL_CLASS" value="Liip\FunctionalTestBundle\Tests\App\AppKernel" />
<env name="SYMFONY_DEPRECATIONS_HELPER" value="weak"/>
</php>

Expand Down
11 changes: 11 additions & 0 deletions src/Annotations/QueryCount.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
<?php

declare(strict_types=1);

/*
* This file is part of the Liip/FunctionalTestBundle
*
* (c) Lukas Kahwe Smith <smith@pooteeweet.org>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/

namespace Liip\FunctionalTestBundle\Annotations;

/**
Expand Down
19 changes: 15 additions & 4 deletions src/Command/RunParatestCommand.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
<?php

declare(strict_types=1);

/*
* This file is part of the Liip/FunctionalTestBundle
*
* (c) Lukas Kahwe Smith <smith@pooteeweet.org>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/

namespace Liip\FunctionalTestBundle\Command;

use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
Expand All @@ -26,7 +37,7 @@ class RunParatestCommand extends ContainerAwareCommand
/**
* Configuration of the command.
*/
protected function configure()
protected function configure(): void
{
$this
->setName('paratest:run')
Expand All @@ -36,7 +47,7 @@ protected function configure()
;
}

protected function prepare()
protected function prepare(): void
{
$this->phpunit = $this->getContainer()->getParameter('liip_functional_test.paratest.phpunit');
$this->process = $this->getContainer()->getParameter('liip_functional_test.paratest.process');
Expand Down Expand Up @@ -73,7 +84,7 @@ protected function prepare()
* @param InputInterface $input
* @param OutputInterface $output
*/
protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): void
{
$this->output = $output;
$this->prepare();
Expand All @@ -88,7 +99,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
'-p '.$this->process.' '.
$input->getArgument('options')
);
$runProcess->run(function ($type, $buffer) use ($output) {
$runProcess->run(function ($type, $buffer) use ($output): void {
$output->write($buffer);
});
}
Expand Down
Loading

0 comments on commit 06782e5

Please sign in to comment.