Skip to content

Commit c010172

Browse files
Add tests
1 parent d4e8f8c commit c010172

11 files changed

+200
-2
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="../../../../phpunit.xsd"
4+
defaultTestSuite="unit">
5+
<testsuites>
6+
<testsuite name="unit">
7+
<directory>tests/unit</directory>
8+
</testsuite>
9+
10+
<testsuite name="end-to-end">
11+
<directory>tests/end-to-end</directory>
12+
</testsuite>
13+
</testsuites>
14+
</phpunit>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="../../../../phpunit.xsd">
4+
<testsuites>
5+
<testsuite name="unit">
6+
<directory>tests/unit</directory>
7+
</testsuite>
8+
9+
<testsuite name="end-to-end">
10+
<directory>tests/end-to-end</directory>
11+
</testsuite>
12+
</testsuites>
13+
14+
<groups>
15+
<exclude>
16+
<group>default</group>
17+
</exclude>
18+
</groups>
19+
</phpunit>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="../../../../phpunit.xsd">
4+
<testsuites>
5+
<testsuite name="unit">
6+
<directory>tests/unit</directory>
7+
</testsuite>
8+
9+
<testsuite name="end-to-end">
10+
<directory>tests/end-to-end</directory>
11+
</testsuite>
12+
</testsuites>
13+
14+
<groups>
15+
<include>
16+
<group>default</group>
17+
</include>
18+
</groups>
19+
</phpunit>

tests/end-to-end/cli/list-suites.phpt renamed to tests/end-to-end/cli/list-suites/happy-path.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ phpunit --configuration ../_files/multiple-testsuites/phpunit.xml --list-suites
44
<?php declare(strict_types=1);
55
$_SERVER['argv'][] = '--do-not-cache-result';
66
$_SERVER['argv'][] = '--configuration';
7-
$_SERVER['argv'][] = __DIR__ . '/../_files/multiple-testsuites/phpunit.xml';
7+
$_SERVER['argv'][] = __DIR__ . '/../../_files/multiple-testsuites/phpunit.xml';
88
$_SERVER['argv'][] = '--list-suites';
99

10-
require_once __DIR__ . '/../../bootstrap.php';
10+
require_once __DIR__ . '/../../../bootstrap.php';
1111

1212
(new PHPUnit\TextUI\Application)->run($_SERVER['argv']);
1313
--EXPECTF--
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
--TEST--
2+
phpunit --configuration ../_files/multiple-testsuites/default-test-suite.xml --list-suites
3+
--FILE--
4+
<?php declare(strict_types=1);
5+
$_SERVER['argv'][] = '--do-not-cache-result';
6+
$_SERVER['argv'][] = '--configuration';
7+
$_SERVER['argv'][] = __DIR__ . '/../../_files/multiple-testsuites/default-test-suite.xml';
8+
$_SERVER['argv'][] = '--list-suites';
9+
10+
require_once __DIR__ . '/../../../bootstrap.php';
11+
12+
(new PHPUnit\TextUI\Application)->run($_SERVER['argv']);
13+
--EXPECTF--
14+
PHPUnit %s by Sebastian Bergmann and contributors.
15+
16+
The defaultTestSuite (XML) and --list-suites (CLI) options cannot be combined, only the default test suite is shown
17+
18+
Available test suite:
19+
- unit (1 test)
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
--TEST--
2+
phpunit --configuration ../_files/multiple-testsuites/phpunit.xml --exclude-group default --list-suites
3+
--FILE--
4+
<?php declare(strict_types=1);
5+
$_SERVER['argv'][] = '--do-not-cache-result';
6+
$_SERVER['argv'][] = '--configuration';
7+
$_SERVER['argv'][] = __DIR__ . '/../../_files/multiple-testsuites/phpunit.xml';
8+
$_SERVER['argv'][] = '--exclude-group';
9+
$_SERVER['argv'][] = 'default';
10+
$_SERVER['argv'][] = '--list-suites';
11+
12+
require_once __DIR__ . '/../../../bootstrap.php';
13+
14+
(new PHPUnit\TextUI\Application)->run($_SERVER['argv']);
15+
--EXPECTF--
16+
PHPUnit %s by Sebastian Bergmann and contributors.
17+
18+
The --exclude-group (CLI) and <groups> (XML) options cannot be combined with --list-suites, --exclude-group and <groups> are ignored
19+
20+
Available test suites:
21+
- end-to-end (1 test)
22+
- unit (1 test)
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
--TEST--
2+
phpunit --configuration ../_files/multiple-testsuites/exclude-group.xml --list-suites
3+
--FILE--
4+
<?php declare(strict_types=1);
5+
$_SERVER['argv'][] = '--do-not-cache-result';
6+
$_SERVER['argv'][] = '--configuration';
7+
$_SERVER['argv'][] = __DIR__ . '/../../_files/multiple-testsuites/exclude-group.xml';
8+
$_SERVER['argv'][] = '--list-suites';
9+
10+
require_once __DIR__ . '/../../../bootstrap.php';
11+
12+
(new PHPUnit\TextUI\Application)->run($_SERVER['argv']);
13+
--EXPECTF--
14+
PHPUnit %s by Sebastian Bergmann and contributors.
15+
16+
The --exclude-group (CLI) and <groups> (XML) options cannot be combined with --list-suites, --exclude-group and <groups> are ignored
17+
18+
Available test suites:
19+
- end-to-end (1 test)
20+
- unit (1 test)
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
--TEST--
2+
phpunit --configuration ../_files/multiple-testsuites/phpunit.xml --filter FooTest --list-suites
3+
--FILE--
4+
<?php declare(strict_types=1);
5+
$_SERVER['argv'][] = '--do-not-cache-result';
6+
$_SERVER['argv'][] = '--configuration';
7+
$_SERVER['argv'][] = __DIR__ . '/../../_files/multiple-testsuites/phpunit.xml';
8+
$_SERVER['argv'][] = '--filter';
9+
$_SERVER['argv'][] = 'FooTest';
10+
$_SERVER['argv'][] = '--list-suites';
11+
12+
require_once __DIR__ . '/../../../bootstrap.php';
13+
14+
(new PHPUnit\TextUI\Application)->run($_SERVER['argv']);
15+
--EXPECTF--
16+
PHPUnit %s by Sebastian Bergmann and contributors.
17+
18+
The --filter and --list-suites options cannot be combined, --filter is ignored
19+
20+
Available test suites:
21+
- end-to-end (1 test)
22+
- unit (1 test)
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
--TEST--
2+
phpunit --configuration ../_files/multiple-testsuites/phpunit.xml --group default --list-suites
3+
--FILE--
4+
<?php declare(strict_types=1);
5+
$_SERVER['argv'][] = '--do-not-cache-result';
6+
$_SERVER['argv'][] = '--configuration';
7+
$_SERVER['argv'][] = __DIR__ . '/../../_files/multiple-testsuites/phpunit.xml';
8+
$_SERVER['argv'][] = '--group';
9+
$_SERVER['argv'][] = 'default';
10+
$_SERVER['argv'][] = '--list-suites';
11+
12+
require_once __DIR__ . '/../../../bootstrap.php';
13+
14+
(new PHPUnit\TextUI\Application)->run($_SERVER['argv']);
15+
--EXPECTF--
16+
PHPUnit %s by Sebastian Bergmann and contributors.
17+
18+
The --group (CLI) and <groups> (XML) options cannot be combined with --list-suites, --group and <groups> are ignored
19+
20+
Available test suites:
21+
- end-to-end (1 test)
22+
- unit (1 test)
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
--TEST--
2+
phpunit --configuration ../_files/multiple-testsuites/include-group.xml --list-suites
3+
--FILE--
4+
<?php declare(strict_types=1);
5+
$_SERVER['argv'][] = '--do-not-cache-result';
6+
$_SERVER['argv'][] = '--configuration';
7+
$_SERVER['argv'][] = __DIR__ . '/../../_files/multiple-testsuites/include-group.xml';
8+
$_SERVER['argv'][] = '--list-suites';
9+
10+
require_once __DIR__ . '/../../../bootstrap.php';
11+
12+
(new PHPUnit\TextUI\Application)->run($_SERVER['argv']);
13+
--EXPECTF--
14+
PHPUnit %s by Sebastian Bergmann and contributors.
15+
16+
The --group (CLI) and <groups> (XML) options cannot be combined with --list-suites, --group and <groups> are ignored
17+
18+
Available test suites:
19+
- end-to-end (1 test)
20+
- unit (1 test)

0 commit comments

Comments
 (0)