Skip to content

Commit 54b4e99

Browse files
Add more tests with data provider
1 parent 2972e30 commit 54b4e99

File tree

12 files changed

+126
-30
lines changed

12 files changed

+126
-30
lines changed

test/EndToEnd/Version06/TestMethod/WithMaximumDurationAnnotation/SleeperTest.php

+15
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,21 @@ public function testSleeperSleepsShorterThanMaximumDurationFromAnnotationWhenTes
8282
self::assertSame($milliseconds, $sleeper->milliseconds());
8383
}
8484

85+
/**
86+
* @maximumDuration 200
87+
* @dataProvider mockDataProvider
88+
*/
89+
public function testSleeperSleepsLongerThanMaximumDurationFromAnnotationWhenTestMethodHasValidMaximumDurationAnnotationAndDataProvider()
90+
{
91+
$milliseconds = 300;
92+
93+
$sleeper = Test\Fixture\Sleeper::fromMilliseconds($milliseconds);
94+
95+
$sleeper->sleep();
96+
97+
self::assertSame($milliseconds, $sleeper->milliseconds());
98+
}
99+
85100
/**
86101
* @maximumDuration 200
87102
*/

test/EndToEnd/Version06/TestMethod/WithMaximumDurationAnnotation/test.phpt

+6-5
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,14 @@ PHPUnit %s
1818
Runtime: %s
1919
Configuration: %s/EndToEnd/Version06/TestMethod/WithMaximumDurationAnnotation/phpunit.xml
2020

21-
..... 5 / 5 (100%)
21+
...... 6 / 6 (100%)
2222

23-
Detected 2 tests where the duration exceeded the maximum duration.
23+
Detected 3 tests where the duration exceeded the maximum duration.
2424

25-
1. 00:00.3%s (00:00.200) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version06\TestMethod\WithMaximumDurationAnnotation\SleeperTest::testSleeperSleepsLongerThanMaximumDurationFromAnnotationWhenTestMethodHasValidMaximumDurationAnnotation
26-
2. 00:00.2%s (00:00.100) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version06\TestMethod\WithMaximumDurationAnnotation\SleeperTest::testSleeperSleepsLongerThanMaximumDurationFromXmlConfigurationWhenTestMethodHasInvalidMaximumDurationAnnotation
25+
1. 00:00.3%s (00:00.200) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version09\TestMethod\WithMaximumDurationAnnotation\SleeperTest::testSleeperSleepsLongerThanMaximumDurationFromAnnotationWhenTestMethodHasValidMaximumDurationAnnotationAndDataProvider with data set #0 ('mockArgument')
26+
2. 00:00.3%s (00:00.200) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version09\TestMethod\WithMaximumDurationAnnotation\SleeperTest::testSleeperSleepsLongerThanMaximumDurationFromAnnotationWhenTestMethodHasValidMaximumDurationAnnotation
27+
3. 00:00.2%s (00:00.100) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version09\TestMethod\WithMaximumDurationAnnotation\SleeperTest::testSleeperSleepsLongerThanMaximumDurationFromXmlConfigurationWhenTestMethodHasInvalidMaximumDurationAnnotation
2728

2829
Time: %s, Memory: %s
2930

30-
OK (5 tests, 5 assertions)
31+
OK (6 tests, 6 assertions)

test/EndToEnd/Version07/TestMethod/WithMaximumDurationAnnotation/SleeperTest.php

+15
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,21 @@ public function testSleeperSleepsShorterThanMaximumDurationFromAnnotationWhenTes
8282
self::assertSame($milliseconds, $sleeper->milliseconds());
8383
}
8484

85+
/**
86+
* @maximumDuration 200
87+
* @dataProvider mockDataProvider
88+
*/
89+
public function testSleeperSleepsLongerThanMaximumDurationFromAnnotationWhenTestMethodHasValidMaximumDurationAnnotationAndDataProvider(): void
90+
{
91+
$milliseconds = 300;
92+
93+
$sleeper = Test\Fixture\Sleeper::fromMilliseconds($milliseconds);
94+
95+
$sleeper->sleep();
96+
97+
self::assertSame($milliseconds, $sleeper->milliseconds());
98+
}
99+
85100
/**
86101
* @maximumDuration 200
87102
*/

test/EndToEnd/Version07/TestMethod/WithMaximumDurationAnnotation/test.phpt

+6-5
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,14 @@ PHPUnit %s
1818
Runtime: %s
1919
Configuration: %s/EndToEnd/Version07/TestMethod/WithMaximumDurationAnnotation/phpunit.xml
2020

21-
..... 5 / 5 (100%)
21+
...... 6 / 6 (100%)
2222

23-
Detected 2 tests where the duration exceeded the maximum duration.
23+
Detected 3 tests where the duration exceeded the maximum duration.
2424

25-
1. 00:00.3%s (00:00.200) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version07\TestMethod\WithMaximumDurationAnnotation\SleeperTest::testSleeperSleepsLongerThanMaximumDurationFromAnnotationWhenTestMethodHasValidMaximumDurationAnnotation
26-
2. 00:00.2%s (00:00.100) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version07\TestMethod\WithMaximumDurationAnnotation\SleeperTest::testSleeperSleepsLongerThanMaximumDurationFromXmlConfigurationWhenTestMethodHasInvalidMaximumDurationAnnotation
25+
1. 00:00.3%s (00:00.200) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version09\TestMethod\WithMaximumDurationAnnotation\SleeperTest::testSleeperSleepsLongerThanMaximumDurationFromAnnotationWhenTestMethodHasValidMaximumDurationAnnotationAndDataProvider with data set #0 ('mockArgument')
26+
2. 00:00.3%s (00:00.200) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version09\TestMethod\WithMaximumDurationAnnotation\SleeperTest::testSleeperSleepsLongerThanMaximumDurationFromAnnotationWhenTestMethodHasValidMaximumDurationAnnotation
27+
3. 00:00.2%s (00:00.100) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version09\TestMethod\WithMaximumDurationAnnotation\SleeperTest::testSleeperSleepsLongerThanMaximumDurationFromXmlConfigurationWhenTestMethodHasInvalidMaximumDurationAnnotation
2728

2829
Time: %s, Memory: %s
2930

30-
OK (5 tests, 5 assertions)
31+
OK (6 tests, 6 assertions)

test/EndToEnd/Version08/TestMethod/WithMaximumDurationAnnotation/SleeperTest.php

+15
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,21 @@ public function testSleeperSleepsShorterThanMaximumDurationFromAnnotationWhenTes
8282
self::assertSame($milliseconds, $sleeper->milliseconds());
8383
}
8484

85+
/**
86+
* @maximumDuration 200
87+
* @dataProvider mockDataProvider
88+
*/
89+
public function testSleeperSleepsLongerThanMaximumDurationFromAnnotationWhenTestMethodHasValidMaximumDurationAnnotationAndDataProvider(): void
90+
{
91+
$milliseconds = 300;
92+
93+
$sleeper = Test\Fixture\Sleeper::fromMilliseconds($milliseconds);
94+
95+
$sleeper->sleep();
96+
97+
self::assertSame($milliseconds, $sleeper->milliseconds());
98+
}
99+
85100
/**
86101
* @maximumDuration 200
87102
*/

test/EndToEnd/Version08/TestMethod/WithMaximumDurationAnnotation/test.phpt

+6-5
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,14 @@ PHPUnit %s
1818
Runtime: %s
1919
Configuration: %s/EndToEnd/Version08/TestMethod/WithMaximumDurationAnnotation/phpunit.xml
2020

21-
..... 5 / 5 (100%)
21+
...... 6 / 6 (100%)
2222

23-
Detected 2 tests where the duration exceeded the maximum duration.
23+
Detected 3 tests where the duration exceeded the maximum duration.
2424

25-
1. 00:00.3%s (00:00.200) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version08\TestMethod\WithMaximumDurationAnnotation\SleeperTest::testSleeperSleepsLongerThanMaximumDurationFromAnnotationWhenTestMethodHasValidMaximumDurationAnnotation
26-
2. 00:00.2%s (00:00.100) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version08\TestMethod\WithMaximumDurationAnnotation\SleeperTest::testSleeperSleepsLongerThanMaximumDurationFromXmlConfigurationWhenTestMethodHasInvalidMaximumDurationAnnotation
25+
1. 00:00.3%s (00:00.200) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version09\TestMethod\WithMaximumDurationAnnotation\SleeperTest::testSleeperSleepsLongerThanMaximumDurationFromAnnotationWhenTestMethodHasValidMaximumDurationAnnotationAndDataProvider with data set #0 ('mockArgument')
26+
2. 00:00.3%s (00:00.200) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version09\TestMethod\WithMaximumDurationAnnotation\SleeperTest::testSleeperSleepsLongerThanMaximumDurationFromAnnotationWhenTestMethodHasValidMaximumDurationAnnotation
27+
3. 00:00.2%s (00:00.100) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version09\TestMethod\WithMaximumDurationAnnotation\SleeperTest::testSleeperSleepsLongerThanMaximumDurationFromXmlConfigurationWhenTestMethodHasInvalidMaximumDurationAnnotation
2728

2829
Time: %s, Memory: %s
2930

30-
OK (5 tests, 5 assertions)
31+
OK (6 tests, 6 assertions)

test/EndToEnd/Version09/TestMethod/WithMaximumDurationAnnotation/SleeperTest.php

+15
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,21 @@ public function testSleeperSleepsShorterThanMaximumDurationFromAnnotationWhenTes
8282
self::assertSame($milliseconds, $sleeper->milliseconds());
8383
}
8484

85+
/**
86+
* @maximumDuration 200
87+
* @dataProvider mockDataProvider
88+
*/
89+
public function testSleeperSleepsLongerThanMaximumDurationFromAnnotationWhenTestMethodHasValidMaximumDurationAnnotationAndDataProvider(): void
90+
{
91+
$milliseconds = 300;
92+
93+
$sleeper = Test\Fixture\Sleeper::fromMilliseconds($milliseconds);
94+
95+
$sleeper->sleep();
96+
97+
self::assertSame($milliseconds, $sleeper->milliseconds());
98+
}
99+
85100
/**
86101
* @maximumDuration 200
87102
*/

test/EndToEnd/Version09/TestMethod/WithMaximumDurationAnnotation/test.phpt

+6-5
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,14 @@ PHPUnit %s
1818
Runtime: %s
1919
Configuration: %s/EndToEnd/Version09/TestMethod/WithMaximumDurationAnnotation/phpunit.xml
2020

21-
..... 5 / 5 (100%)
21+
...... 6 / 6 (100%)
2222

23-
Detected 2 tests where the duration exceeded the maximum duration.
23+
Detected 3 tests where the duration exceeded the maximum duration.
2424

25-
1. 00:00.3%s (00:00.200) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version09\TestMethod\WithMaximumDurationAnnotation\SleeperTest::testSleeperSleepsLongerThanMaximumDurationFromAnnotationWhenTestMethodHasValidMaximumDurationAnnotation
26-
2. 00:00.2%s (00:00.100) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version09\TestMethod\WithMaximumDurationAnnotation\SleeperTest::testSleeperSleepsLongerThanMaximumDurationFromXmlConfigurationWhenTestMethodHasInvalidMaximumDurationAnnotation
25+
1. 00:00.3%s (00:00.200) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version09\TestMethod\WithMaximumDurationAnnotation\SleeperTest::testSleeperSleepsLongerThanMaximumDurationFromAnnotationWhenTestMethodHasValidMaximumDurationAnnotationAndDataProvider with data set #0 ('mockArgument')
26+
2. 00:00.3%s (00:00.200) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version09\TestMethod\WithMaximumDurationAnnotation\SleeperTest::testSleeperSleepsLongerThanMaximumDurationFromAnnotationWhenTestMethodHasValidMaximumDurationAnnotation
27+
3. 00:00.2%s (00:00.100) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version09\TestMethod\WithMaximumDurationAnnotation\SleeperTest::testSleeperSleepsLongerThanMaximumDurationFromXmlConfigurationWhenTestMethodHasInvalidMaximumDurationAnnotation
2728

2829
Time: %s, Memory: %s
2930

30-
OK (5 tests, 5 assertions)
31+
OK (6 tests, 6 assertions)

test/EndToEnd/Version10/TestMethod/WithMaximumDurationAnnotation/SleeperTest.php

+15
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,21 @@ public function testSleeperSleepsShorterThanMaximumDurationFromAnnotationWhenTes
8080
self::assertSame($milliseconds, $sleeper->milliseconds());
8181
}
8282

83+
/**
84+
* @maximumDuration 200
85+
* @dataProvider mockDataProvider
86+
*/
87+
public function testSleeperSleepsLongerThanMaximumDurationFromAnnotationWhenTestMethodHasValidMaximumDurationAnnotationAndDataProvider(): void
88+
{
89+
$milliseconds = 300;
90+
91+
$sleeper = Test\Fixture\Sleeper::fromMilliseconds($milliseconds);
92+
93+
$sleeper->sleep();
94+
95+
self::assertSame($milliseconds, $sleeper->milliseconds());
96+
}
97+
8398
/**
8499
* @maximumDuration 200
85100
*/

test/EndToEnd/Version10/TestMethod/WithMaximumDurationAnnotation/test.phpt

+6-5
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,14 @@ PHPUnit %s
2020
Runtime: %s
2121
Configuration: %s/EndToEnd/Version10/TestMethod/WithMaximumDurationAnnotation/phpunit.xml
2222

23-
..... 5 / 5 (100%)
23+
...... 6 / 6 (100%)
2424

25-
Detected 2 tests where the duration exceeded the maximum duration.
25+
Detected 3 tests where the duration exceeded the maximum duration.
2626

27-
1. 00:00.3%s (00:00.200) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version10\TestMethod\WithMaximumDurationAnnotation\SleeperTest::testSleeperSleepsLongerThanMaximumDurationFromAnnotationWhenTestMethodHasValidMaximumDurationAnnotation
28-
2. 00:00.2%s (00:00.100) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version10\TestMethod\WithMaximumDurationAnnotation\SleeperTest::testSleeperSleepsLongerThanMaximumDurationFromXmlConfigurationWhenTestMethodHasInvalidMaximumDurationAnnotation
27+
1. 00:00.3%s (00:00.200) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version09\TestMethod\WithMaximumDurationAnnotation\SleeperTest::testSleeperSleepsLongerThanMaximumDurationFromAnnotationWhenTestMethodHasValidMaximumDurationAnnotationAndDataProvider with data set #0 ('mockArgument')
28+
2. 00:00.3%s (00:00.200) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version09\TestMethod\WithMaximumDurationAnnotation\SleeperTest::testSleeperSleepsLongerThanMaximumDurationFromAnnotationWhenTestMethodHasValidMaximumDurationAnnotation
29+
3. 00:00.2%s (00:00.100) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version09\TestMethod\WithMaximumDurationAnnotation\SleeperTest::testSleeperSleepsLongerThanMaximumDurationFromXmlConfigurationWhenTestMethodHasInvalidMaximumDurationAnnotation
2930

3031
Time: %s, Memory: %s
3132

32-
OK (5 tests, 5 assertions)
33+
OK (6 tests, 6 assertions)

test/EndToEnd/Version11/TestMethod/WithMaximumDurationAnnotation/SleeperTest.php

+15
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,21 @@ public function testSleeperSleepsShorterThanMaximumDurationFromAnnotationWhenTes
8080
self::assertSame($milliseconds, $sleeper->milliseconds());
8181
}
8282

83+
/**
84+
* @maximumDuration 200
85+
* @dataProvider mockDataProvider
86+
*/
87+
public function testSleeperSleepsLongerThanMaximumDurationFromAnnotationWhenTestMethodHasValidMaximumDurationAnnotationAndDataProvider(): void
88+
{
89+
$milliseconds = 300;
90+
91+
$sleeper = Test\Fixture\Sleeper::fromMilliseconds($milliseconds);
92+
93+
$sleeper->sleep();
94+
95+
self::assertSame($milliseconds, $sleeper->milliseconds());
96+
}
97+
8398
/**
8499
* @maximumDuration 200
85100
*/

test/EndToEnd/Version11/TestMethod/WithMaximumDurationAnnotation/test.phpt

+6-5
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,14 @@ PHPUnit %s
2020
Runtime: %s
2121
Configuration: %s/EndToEnd/Version11/TestMethod/WithMaximumDurationAnnotation/phpunit.xml
2222

23-
..... 5 / 5 (100%)
23+
...... 6 / 6 (100%)
2424

25-
Detected 2 tests where the duration exceeded the maximum duration.
25+
Detected 3 tests where the duration exceeded the maximum duration.
2626

27-
1. 00:00.3%s (00:00.200) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version11\TestMethod\WithMaximumDurationAnnotation\SleeperTest::testSleeperSleepsLongerThanMaximumDurationFromAnnotationWhenTestMethodHasValidMaximumDurationAnnotation
28-
2. 00:00.2%s (00:00.100) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version11\TestMethod\WithMaximumDurationAnnotation\SleeperTest::testSleeperSleepsLongerThanMaximumDurationFromXmlConfigurationWhenTestMethodHasInvalidMaximumDurationAnnotation
27+
1. 00:00.3%s (00:00.200) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version09\TestMethod\WithMaximumDurationAnnotation\SleeperTest::testSleeperSleepsLongerThanMaximumDurationFromAnnotationWhenTestMethodHasValidMaximumDurationAnnotationAndDataProvider with data set #0 ('mockArgument')
28+
2. 00:00.3%s (00:00.200) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version09\TestMethod\WithMaximumDurationAnnotation\SleeperTest::testSleeperSleepsLongerThanMaximumDurationFromAnnotationWhenTestMethodHasValidMaximumDurationAnnotation
29+
3. 00:00.2%s (00:00.100) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version09\TestMethod\WithMaximumDurationAnnotation\SleeperTest::testSleeperSleepsLongerThanMaximumDurationFromXmlConfigurationWhenTestMethodHasInvalidMaximumDurationAnnotation
2930

3031
Time: %s, Memory: %s
3132

32-
OK (5 tests, 5 assertions)
33+
OK (6 tests, 6 assertions)

0 commit comments

Comments
 (0)