Skip to content

Commit

Permalink
Improve testing (#92)
Browse files Browse the repository at this point in the history
* Update to PHPUnit 8

* Add CI jobs for PHP 7.4
  • Loading branch information
Jean85 authored Mar 31, 2020
1 parent 7390307 commit c545d0a
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 11 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ env:
- PHP_IMG="php-7.2-mongoext-1.5.3-20200327" MONGO_IMG="percona/percona-server-mongodb:4.0"
- PHP_IMG="php-7.3-mongoext-1.5.3-20200327" MONGO_IMG="mongo:4.0"
- PHP_IMG="php-7.3-mongoext-1.5.3-20200327" MONGO_IMG="percona/percona-server-mongodb:4.0"
- PHP_IMG="php-7.4-mongoext-1.6.0-20200327" MONGO_IMG="mongo:4.0"
- PHP_IMG="php-7.4-mongoext-1.6.0-20200327" MONGO_IMG="percona/percona-server-mongodb:4.0"

before_install:
- rm docker-compose.yml
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
"symfony/framework-bundle": "^3.4 || ^4.3"
},
"require-dev": {
"matthiasnoback/symfony-dependency-injection-test": "^3",
"matthiasnoback/symfony-dependency-injection-test": "^4",
"symfony/web-profiler-bundle": "^3.4 || ^4.3",
"symfony/console": "^3.4 || ^4.3",
"phpunit/phpunit": "^7.0",
"phpunit/phpunit": "^8.5.2",
"symfony/phpunit-bridge": "^4.2",
"facile-it/facile-coding-standard": "^0.3.1",
"phpstan/phpstan": "^0.12"
Expand Down
2 changes: 1 addition & 1 deletion tests/Functional/Command/AbstractCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function test_AbstractCommand_execution(array $arguments)
$commandTester = new CommandTester($command);
$commandTester->execute(array_merge(['command' => $command->getName()], $arguments));

self::assertContains('Executed', $commandTester->getDisplay());
self::assertStringContainsString('Executed', $commandTester->getDisplay());
}

public function test_AbstractCommand_connection_exception()
Expand Down
2 changes: 1 addition & 1 deletion tests/Functional/Command/DropCollectionCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function test_command()
$commandTester = new CommandTester($command);
$commandTester->execute(['command' => $command->getName(), 'collection' => 'testFunctionalCollection']);

self::assertContains('Collection dropped', $commandTester->getDisplay());
self::assertStringContainsString('Collection dropped', $commandTester->getDisplay());
}

private function addCommandToApplication()
Expand Down
2 changes: 1 addition & 1 deletion tests/Functional/Command/DropDatabaseCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function test_command()
$commandTester = new CommandTester($command);
$commandTester->execute(['command' => $command->getName()]);

self::assertContains('Database dropped', $commandTester->getDisplay());
self::assertStringContainsString('Database dropped', $commandTester->getDisplay());
}

private function addCommandToApplication()
Expand Down
2 changes: 1 addition & 1 deletion tests/Functional/Command/LoadFixturesCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function test_command()
self::assertEquals('fixture', $fixtures[0]['type']);
self::assertEquals('test', $fixtures[0]['data']);

self::assertContains('Done, loaded 4 fixtures files', $commandTester->getDisplay());
self::assertStringContainsString('Done, loaded 4 fixtures files', $commandTester->getDisplay());
}

public function test_command_not_fixtures_found()
Expand Down
10 changes: 5 additions & 5 deletions tests/Unit/Fixtures/FixtureSorterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ static function (MongoFixtureInterface $fixture): string {
)
);

$this->assertContains('a', $collectionsSorted);
$this->assertContains('b', $collectionsSorted);
$this->assertContains('c', $collectionsSorted);
$this->assertContains('d', $collectionsSorted);
$this->assertContains('e', $collectionsSorted);
$this->assertStringContainsString('a', $collectionsSorted);
$this->assertStringContainsString('b', $collectionsSorted);
$this->assertStringContainsString('c', $collectionsSorted);
$this->assertStringContainsString('d', $collectionsSorted);
$this->assertStringContainsString('e', $collectionsSorted);

$this->assertIsAfter($collectionsSorted, 'a', ['b', 'c', 'd', 'e']);
$this->assertIsAfter($collectionsSorted, 'b', ['c', 'e']);
Expand Down

0 comments on commit c545d0a

Please sign in to comment.