44
55use ArrayObject ;
66use DataValues \StringValue ;
7+ use InvalidArgumentException ;
8+ use OutOfBoundsException ;
79use PHPUnit_Framework_TestCase ;
810use ReflectionClass ;
911use ReflectionMethod ;
12+ use RuntimeException ;
1013use stdClass ;
1114use Wikibase \DataModel \ByPropertyIdArray ;
1215use Wikibase \DataModel \Entity \PropertyId ;
@@ -39,7 +42,7 @@ public function testGivenNonTraversableObject_constructorDoesNotCastObjectToArra
3942 $ object = new stdClass ();
4043 $ object ->property = true ;
4144
42- $ this ->setExpectedException ( ' InvalidArgumentException ' );
45+ $ this ->setExpectedException ( InvalidArgumentException::class );
4346 new ByPropertyIdArray ( $ object );
4447 }
4548
@@ -67,7 +70,7 @@ public function testArrayObjectNotConstructedFromObject() {
6770 * @return ReflectionMethod
6871 */
6972 protected static function getMethod ( $ methodName ) {
70- $ class = new ReflectionClass ( ' Wikibase\DataModel\ ByPropertyIdArray' );
73+ $ class = new ReflectionClass ( ByPropertyIdArray::class );
7174 $ method = $ class ->getMethod ( $ methodName );
7275 $ method ->setAccessible ( true );
7376 return $ method ;
@@ -209,22 +212,22 @@ public function testGetByNotSetIdThrowsException() {
209212 $ indexedArray = new ByPropertyIdArray ();
210213 $ indexedArray ->buildIndex ();
211214
212- $ this ->setExpectedException ( ' OutOfBoundsException ' );
215+ $ this ->setExpectedException ( OutOfBoundsException::class );
213216
214217 $ indexedArray ->getByPropertyId ( new PropertyId ( 'P9000 ' ) );
215218 }
216219
217220 public function testNotBuildExceptionIsThrownForByPropertyId () {
218221 $ indexedArray = new ByPropertyIdArray ();
219222
220- $ this ->setExpectedException ( ' RuntimeException ' );
223+ $ this ->setExpectedException ( RuntimeException::class );
221224 $ indexedArray ->getByPropertyId ( new PropertyId ( 'P9000 ' ) );
222225 }
223226
224227 public function testNotBuildExceptionIsThrownForGetPropertyIds () {
225228 $ indexedArray = new ByPropertyIdArray ();
226229
227- $ this ->setExpectedException ( ' RuntimeException ' );
230+ $ this ->setExpectedException ( RuntimeException::class );
228231 $ indexedArray ->getPropertyIds ();
229232 }
230233
@@ -341,7 +344,7 @@ public function testMoveThrowingOutOfBoundsExceptionIfObjectNotPresent() {
341344 $ indexedArray = new ByPropertyIdArray ( $ statements );
342345 $ indexedArray ->buildIndex ();
343346
344- $ this ->setExpectedException ( ' OutOfBoundsException ' );
347+ $ this ->setExpectedException ( OutOfBoundsException::class );
345348
346349 $ indexedArray ->moveObjectToIndex ( new Statement ( new PropertyNoValueSnak ( new PropertyId ( 'P9999 ' ) ) ), 0 );
347350 }
@@ -351,7 +354,7 @@ public function testMoveThrowingOutOfBoundsExceptionOnInvalidIndex() {
351354 $ indexedArray = new ByPropertyIdArray ( $ statements );
352355 $ indexedArray ->buildIndex ();
353356
354- $ this ->setExpectedException ( ' OutOfBoundsException ' );
357+ $ this ->setExpectedException ( OutOfBoundsException::class );
355358
356359 $ indexedArray ->moveObjectToIndex ( $ statements [0 ], 9999 );
357360 }
0 commit comments