12
12
use PHPUnit \Framework \AssertionFailedError ;
13
13
use PHPUnit \Framework \Constraint \IsEqual ;
14
14
use PHPUnit \Framework \IncompleteTestError ;
15
+ use PHPUnit \Framework \SkippedTestError ;
15
16
use PHPUnit \Framework \SkippedWithMessageException ;
17
+ use PHPUnit \Runner \Version as PHPUnitVersion ;
16
18
use RuntimeException ;
17
19
use stdClass ;
18
20
@@ -46,14 +48,14 @@ public function testPHPUnitAsserts()
46
48
{
47
49
$ this ->module ->assertArrayHasKey ('one ' , ['one ' => 1 , 'two ' => 2 ]);
48
50
$ this ->module ->assertArrayNotHasKey ('three ' , ['one ' => 1 , 'two ' => 2 ]);
49
- $ this ->module ->assertClassHasAttribute ('foo ' , \DummyClass::class);
50
- $ this ->module ->assertClassHasStaticAttribute ('staticFoo ' , \DummyClass::class);
51
- $ this ->module ->assertClassNotHasAttribute ('bar ' , \DummyClass::class);
52
- $ this ->module ->assertClassNotHasStaticAttribute ('staticBar ' , \DummyClass::class);
51
+ $ this ->module ->assertClassHasAttribute ('foo ' , \Support \ Data \ DummyClass::class);
52
+ $ this ->module ->assertClassHasStaticAttribute ('staticFoo ' , \Support \ Data \ DummyClass::class);
53
+ $ this ->module ->assertClassNotHasAttribute ('bar ' , \Support \ Data \ DummyClass::class);
54
+ $ this ->module ->assertClassNotHasStaticAttribute ('staticBar ' , \Support \ Data \ DummyClass::class);
53
55
$ this ->module ->assertContains (1 , [1 , 2 ]);
54
56
$ this ->module ->assertContainsEquals (2 , [1 , 2 ]);
55
- $ this ->module ->assertContainsOnly (\DummyClass::class, [new \DummyClass (), new \DummyClass ()]);
56
- $ this ->module ->assertContainsOnlyInstancesOf (\DummyClass::class, [new \DummyClass (), new \DummyClass ()]);
57
+ $ this ->module ->assertContainsOnly (\Support \ Data \ DummyClass::class, [new \Support \ Data \ DummyClass (), new \ Support \ Data \DummyClass ()]);
58
+ $ this ->module ->assertContainsOnlyInstancesOf (\Support \ Data \ DummyClass::class, [new \Support \ Data \ DummyClass (), new \ Support \ Data \DummyClass ()]);
57
59
$ this ->module ->assertCount (3 , [1 , 2 , 3 ]);
58
60
$ this ->module ->assertDirectoryDoesNotExist (__DIR__ .'notExist ' );
59
61
$ this ->module ->assertDirectoryExists (__DIR__ );
@@ -130,7 +132,7 @@ public function testPHPUnitAsserts()
130
132
$ this ->module ->assertNan (sqrt (-1 ));
131
133
$ this ->module ->assertNotContains ('three ' , ['one ' , 'two ' ]);
132
134
$ this ->module ->assertNotContainsEquals (3 , [1 , 2 ]);
133
- $ this ->module ->assertNotContainsOnly (\DummyClass::class, [new \DummyClass (), new Exception ()]);
135
+ $ this ->module ->assertNotContainsOnly (\Support \ Data \ DummyClass::class, [new \ Support \ Data \DummyClass (), new Exception ()]);
134
136
$ this ->module ->assertNotCount (1 , ['one ' , 'two ' ]);
135
137
$ this ->module ->assertNotEmpty ([1 ]);
136
138
$ this ->module ->assertNotEquals (true , false );
@@ -150,8 +152,8 @@ public function testPHPUnitAsserts()
150
152
$ this ->module ->assertNotTrue (null );
151
153
$ this ->module ->assertNotTrue ('foo ' );
152
154
$ this ->module ->assertNull (null );
153
- $ this ->module ->assertObjectHasAttribute ('foo ' , new \DummyClass ());
154
- $ this ->module ->assertObjectNotHasAttribute ('bar ' , new \DummyClass ());
155
+ $ this ->module ->assertObjectHasAttribute ('foo ' , new \Support \ Data \ DummyClass ());
156
+ $ this ->module ->assertObjectNotHasAttribute ('bar ' , new \Support \ Data \ DummyClass ());
155
157
$ this ->module ->assertSame (1 , 1 );
156
158
$ this ->module ->assertSameSize ([1 , 2 , 3 ], [1 , 2 , 3 ]);
157
159
$ this ->module ->assertStringContainsString ('bar ' , 'foobar ' );
@@ -280,8 +282,12 @@ public function testMarkTestIncomplete()
280
282
281
283
public function testMarkTestSkipped ()
282
284
{
283
- $ this ->expectException (SkippedWithMessageException::class);
284
285
$ this ->expectExceptionMessage ('foobar ' );
286
+ if (PHPUnitVersion::series () < 10 ) {
287
+ $ this ->expectException (SkippedTestError::class);
288
+ } else {
289
+ $ this ->expectException (SkippedWithMessageException::class);
290
+ }
285
291
286
292
$ this ->module ->markTestSkipped ('foobar ' );
287
293
}
0 commit comments