File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2525 "php" : " ^8.1" ,
2626 "bigcommerce/injector" : " ^4.1" ,
2727 "phpspec/prophecy-phpunit" : " ^2.0" ,
28- "phpunit/phpunit" : " ^10.0"
28+ "phpunit/phpunit" : " ^9.5 || ^10.0"
2929 },
3030 "require-dev" : {
3131 "phpstan/phpstan" : " ^1.10"
Original file line number Diff line number Diff line change @@ -15,7 +15,8 @@ public function testTestShouldNotBeRiskyWhenItHasProphecyExpectations(): void
1515
1616 $ riskyTest ->runBare ();
1717
18- $ this ->assertSame (1 , $ riskyTest ->numberOfAssertionsPerformed ());
18+ $ this ->assertFalse ($ riskyTest ->isRisky ());
19+
1920 }
2021
2122 public function testTestShouldBeRiskyWhenItHasNoAssertions (): void
@@ -24,6 +25,6 @@ public function testTestShouldBeRiskyWhenItHasNoAssertions(): void
2425
2526 $ riskyTest ->runBare ();
2627
27- $ this ->assertSame ( 0 , $ riskyTest ->numberOfAssertionsPerformed ());
28+ $ this ->assertTrue ( $ riskyTest ->isRisky ());
2829 }
2930}
Original file line number Diff line number Diff line change 33
44namespace Tests \Dummy ;
55
6+ use BadMethodCallException ;
67use Bigcommerce \MockInjector \AutoMockingTest ;
8+ use Exception ;
79use Prophecy \Prophecy \ObjectProphecy ;
810
911/**
@@ -33,4 +35,17 @@ public function testWithProphecyExpectations() : void
3335 public function testWithoutAssertions () : void
3436 {
3537 }
38+
39+ public function isRisky (): bool
40+ {
41+ if (is_callable ([$ this , 'numberOfAssertionsPerformed ' ])) {
42+ return $ this ->numberOfAssertionsPerformed () === 0 ;
43+ }
44+
45+ if (is_callable ([$ this , 'getNumAssertions ' ])) {
46+ return $ this ->getNumAssertions () === 0 ;
47+ }
48+
49+ throw new BadMethodCallException ("Could not check the number of assertions performed " );
50+ }
3651}
You can’t perform that action at this time.
0 commit comments