22
33use Pace \Model ;
44use Pace \KeyCollection ;
5+ use PHPUnit \Framework \TestCase ;
56
6- class KeyCollectionTest extends PHPUnit_Framework_TestCase
7+ class KeyCollectionTest extends TestCase
78{
8- public function tearDown ()
9+ public function tearDown (): void
910 {
1011 Mockery::close ();
1112 }
@@ -16,7 +17,7 @@ public function testAll()
1617 $ collection = new KeyCollection ($ model , [1 , 2 , 3 ]);
1718 $ model ->shouldReceive ('read ' )->times (3 )->andReturnSelf ();
1819 $ all = $ collection ->all ();
19- $ this ->assertInternalType ( ' array ' , $ all );
20+ $ this ->assertIsArray ( $ all );
2021 $ this ->assertContainsOnlyInstancesOf (Model::class, $ all );
2122 }
2223
@@ -66,13 +67,11 @@ public function testLast()
6667 $ this ->assertInstanceOf (Model::class, $ collection ->last ());
6768 }
6869
69- /**
70- * @expectedException \OutOfBoundsException
71- */
7270 public function testGetThrowsOutOfBoundsException ()
7371 {
7472 $ model = Mockery::mock (Model::class);
7573 $ collection = new KeyCollection ($ model , [1 ]);
74+ $ this ->expectException (OutOfBoundsException::class);
7675 $ collection ->get (2 );
7776 }
7877
@@ -102,7 +101,7 @@ public function testJsonSerializable()
102101 $ model ->shouldReceive ('read ' )->with (5 )->once ()->andReturnSelf ();
103102 $ array = $ collection ->jsonSerialize ();
104103 $ this ->assertInstanceOf ('JsonSerializable ' , $ collection );
105- $ this ->assertInternalType ( ' array ' , $ array );
104+ $ this ->assertIsArray ( $ array );
106105 $ this ->assertContainsOnlyInstancesOf ('JsonSerializable ' , $ array );
107106 }
108107
@@ -116,23 +115,19 @@ public function testArrayAccess()
116115 $ this ->assertInstanceOf (Model::class, $ collection [8 ]);
117116 }
118117
119- /**
120- * @expectedException \RuntimeException
121- */
122118 public function testImmutableSet ()
123119 {
124120 $ model = Mockery::mock (Model::class);
125121 $ collection = new KeyCollection ($ model , []);
122+ $ this ->expectException (RuntimeException::class);
126123 $ collection [0 ] = 1 ;
127124 }
128125
129- /**
130- * @expectedException \RuntimeException
131- */
132126 public function testImmutableUnset ()
133127 {
134128 $ model = Mockery::mock (Model::class);
135129 $ collection = new KeyCollection ($ model , [1 ]);
130+ $ this ->expectException (RuntimeException::class);
136131 unset($ collection [1 ]);
137132 }
138133
0 commit comments