mirror of
https://github.com/wiosna-dev/common-library.git
synced 2026-03-12 09:31:51 +01:00
PHPUnit > execute tests in random order
This commit is contained in:
@@ -10,6 +10,7 @@ Common and useful classes, methods, exceptions etc.
|
|||||||
4. Travis CI > run many tasks using Phing (instead of PHPUnit only)
|
4. Travis CI > run many tasks using Phing (instead of PHPUnit only)
|
||||||
5. Fix integration with [Coveralls](https://www.coveralls.io) (available as the badge in [README.md](README.md))
|
5. Fix integration with [Coveralls](https://www.coveralls.io) (available as the badge in [README.md](README.md))
|
||||||
6. Implement [PHPStan](https://github.com/phpstan/phpstan)
|
6. Implement [PHPStan](https://github.com/phpstan/phpstan)
|
||||||
|
7. PHPUnit > execute tests in random order
|
||||||
|
|
||||||
# 1.0.1
|
# 1.0.1
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
<!-- https://phpunit.de/manual/4.8/en/appendixes.configuration.html -->
|
<!-- https://phpunit.readthedocs.io/en/8.0/ -->
|
||||||
<phpunit
|
<phpunit
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/4.8/phpunit.xsd"
|
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/4.8/phpunit.xsd"
|
||||||
bootstrap="vendor/autoload.php"
|
bootstrap="vendor/autoload.php"
|
||||||
colors="true"
|
colors="true"
|
||||||
|
executionOrder="random"
|
||||||
verbose="true"
|
verbose="true"
|
||||||
>
|
>
|
||||||
<php>
|
<php>
|
||||||
|
|||||||
@@ -347,27 +347,30 @@ class CollectionTest extends BaseTestCase
|
|||||||
*/
|
*/
|
||||||
public function provideElementToAdd()
|
public function provideElementToAdd()
|
||||||
{
|
{
|
||||||
$collection = new Collection();
|
|
||||||
|
|
||||||
yield[
|
yield[
|
||||||
'test1',
|
'This is test 1',
|
||||||
1,
|
1,
|
||||||
0,
|
0,
|
||||||
$collection,
|
new Collection(),
|
||||||
];
|
];
|
||||||
|
|
||||||
yield[
|
yield[
|
||||||
'test2',
|
'This is test 2',
|
||||||
2,
|
2,
|
||||||
1,
|
1,
|
||||||
$collection,
|
new Collection([
|
||||||
|
'I am 1st',
|
||||||
|
]),
|
||||||
];
|
];
|
||||||
|
|
||||||
yield[
|
yield[
|
||||||
'test3',
|
'This is test 3',
|
||||||
3,
|
3,
|
||||||
2,
|
2,
|
||||||
$collection,
|
new Collection([
|
||||||
|
'I am 1st',
|
||||||
|
'I am 2nd',
|
||||||
|
]),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -378,46 +381,58 @@ class CollectionTest extends BaseTestCase
|
|||||||
*/
|
*/
|
||||||
public function provideElementToAddWithIndex()
|
public function provideElementToAddWithIndex()
|
||||||
{
|
{
|
||||||
$collection = new Collection();
|
|
||||||
|
|
||||||
yield[
|
yield[
|
||||||
|
'This is test 1',
|
||||||
'test1',
|
'test1',
|
||||||
'aa',
|
|
||||||
1,
|
1,
|
||||||
'aa',
|
'test1',
|
||||||
$collection,
|
new Collection(),
|
||||||
];
|
];
|
||||||
|
|
||||||
yield[
|
yield[
|
||||||
|
'This is test 2',
|
||||||
'test2',
|
'test2',
|
||||||
'oo',
|
|
||||||
2,
|
2,
|
||||||
'oo',
|
'test2',
|
||||||
$collection,
|
new Collection([
|
||||||
|
'test1' => 'I am 1st',
|
||||||
|
]),
|
||||||
];
|
];
|
||||||
|
|
||||||
yield[
|
yield[
|
||||||
'test3',
|
'This is test 3',
|
||||||
null,
|
null,
|
||||||
3,
|
3,
|
||||||
0,
|
0,
|
||||||
$collection,
|
new Collection([
|
||||||
|
'test1' => 'I am 1st',
|
||||||
|
'test2' => 'I am 2nd',
|
||||||
|
]),
|
||||||
];
|
];
|
||||||
|
|
||||||
yield[
|
yield[
|
||||||
'test4',
|
'This is test 4',
|
||||||
'',
|
'',
|
||||||
4,
|
4,
|
||||||
1,
|
1,
|
||||||
$collection,
|
new Collection([
|
||||||
|
'test1' => 'I am 1st',
|
||||||
|
'test2' => 'I am 2nd',
|
||||||
|
'I am 3rd',
|
||||||
|
]),
|
||||||
];
|
];
|
||||||
|
|
||||||
yield[
|
yield[
|
||||||
|
'This is test 5',
|
||||||
'test5',
|
'test5',
|
||||||
'vv',
|
|
||||||
5,
|
5,
|
||||||
'vv',
|
'test5',
|
||||||
$collection,
|
new Collection([
|
||||||
|
'test1' => 'I am 1st',
|
||||||
|
'test2' => 'I am 2nd',
|
||||||
|
2 => 'I am 3rd',
|
||||||
|
3 => 'I am 4th',
|
||||||
|
]),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -60,6 +60,15 @@ class UriTest extends BaseTestCase
|
|||||||
*/
|
*/
|
||||||
public function testReplenishProtocol($expected, $url, $protocol = '')
|
public function testReplenishProtocol($expected, $url, $protocol = '')
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
* Required to get protocol when it's not provided and to void test failure:
|
||||||
|
*
|
||||||
|
* Failed asserting that two strings are identical.
|
||||||
|
* Expected :'://test'
|
||||||
|
* Actual :'http://test'
|
||||||
|
*/
|
||||||
|
$_SERVER['SERVER_PROTOCOL'] = 'HTTP/1.1';
|
||||||
|
|
||||||
self::assertSame($expected, Uri::replenishProtocol($url, $protocol));
|
self::assertSame($expected, Uri::replenishProtocol($url, $protocol));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -251,7 +260,7 @@ class UriTest extends BaseTestCase
|
|||||||
public function provideUrlToReplenishProtocol()
|
public function provideUrlToReplenishProtocol()
|
||||||
{
|
{
|
||||||
yield[
|
yield[
|
||||||
'://test',
|
'http://test',
|
||||||
'test',
|
'test',
|
||||||
'',
|
'',
|
||||||
];
|
];
|
||||||
|
|||||||
Reference in New Issue
Block a user