@@ -362,15 +362,16 @@ public function testGetContributorsDecodesResponseToArray()
362362 $ this ->assertInternalType ('array ' , $ contributors );
363363
364364 array_walk ($ contributors , function ($ contributor ) {
365- $ this ->assertInternalType ('array ' , $ contributor );
366- $ this ->assertArrayHasKey ('author ' , $ contributor );
365+ $ this ->assertInstanceOf (stdClass::class, $ contributor );
367366
368- $ author = $ contributor[ ' author ' ] ;
367+ $ this -> assertObjectHasAttribute ( ' total ' , $ contributor) ;
369368
370- $ this ->assertInternalType ('array ' , $ author );
371- $ this ->assertArrayHasKey ('login ' , $ author );
372- $ this ->assertArrayHasKey ('avatar_url ' , $ author );
373- $ this ->assertArrayHasKey ('html_url ' , $ author );
369+ $ this ->assertObjectHasAttribute ('author ' , $ contributor );
370+ $ this ->assertInstanceOf (stdClass::class, $ contributor ->author );
371+
372+ $ this ->assertObjectHasAttribute ('login ' , $ contributor ->author );
373+ $ this ->assertObjectHasAttribute ('avatar_url ' , $ contributor ->author );
374+ $ this ->assertObjectHasAttribute ('html_url ' , $ contributor ->author );
374375 });
375376 }
376377
@@ -424,21 +425,22 @@ public function testGetContributorsReturnsContributorsInReverseOrder()
424425
425426 $ expected = array_pop ($ contributorsAsReturned );
426427
427- $ this ->assertInternalType ('array ' , $ contributor );
428- $ this ->assertArrayHasKey ('author ' , $ contributor );
428+ $ this ->assertInstanceOf (stdClass::class, $ contributor );
429429
430- $ author = $ contributor ['author ' ];
430+ $ this ->assertObjectHasAttribute ('total ' , $ contributor );
431+ $ this ->assertSame ($ expected ->total , $ contributor ->total );
431432
432- $ this ->assertInternalType ('array ' , $ author );
433+ $ this ->assertObjectHasAttribute ('author ' , $ contributor );
434+ $ this ->assertInstanceOf (stdClass::class, $ contributor ->author );
433435
434- $ this ->assertArrayHasKey ('login ' , $ author );
435- $ this ->assertSame ($ expected ->author ->login , $ author[ ' login ' ] );
436+ $ this ->assertObjectHasAttribute ('login ' , $ contributor -> author );
437+ $ this ->assertSame ($ expected ->author ->login , $ contributor -> author -> login );
436438
437- $ this ->assertArrayHasKey ('avatar_url ' , $ author );
438- $ this ->assertSame ($ expected ->author ->avatar_url , $ author[ ' avatar_url ' ] );
439+ $ this ->assertObjectHasAttribute ('avatar_url ' , $ contributor -> author );
440+ $ this ->assertSame ($ expected ->author ->avatar_url , $ contributor -> author -> avatar_url );
439441
440- $ this ->assertArrayHasKey ('html_url ' , $ author );
441- $ this ->assertSame ($ expected ->author ->html_url , $ author[ ' html_url ' ] );
442+ $ this ->assertObjectHasAttribute ('html_url ' , $ contributor -> author );
443+ $ this ->assertSame ($ expected ->author ->html_url , $ contributor -> author -> html_url );
442444 });
443445 }
444446
@@ -487,15 +489,15 @@ public function testGetContributorsReturnsFalseIfRuntimeExceptionIsThrown()
487489 */
488490 private function contributor ()
489491 {
490- $ author = new stdClass ();
492+ $ contributor = new stdClass ();
491493
492- $ author ->login = $ this ->faker ()->unique ()->userName ;
493- $ author ->avatar_url = $ this ->faker ()->unique ()->url ;
494- $ author ->html_url = $ this ->faker ()->unique ()->url ;
494+ $ contributor ->total = $ this ->faker ()->randomNumber ();
495495
496- $ contributor = new stdClass ();
496+ $ contributor-> author = new stdClass ();
497497
498- $ contributor ->author = $ author ;
498+ $ contributor ->author ->login = $ this ->faker ()->unique ()->userName ;
499+ $ contributor ->author ->avatar_url = $ this ->faker ()->unique ()->url ;
500+ $ contributor ->author ->html_url = $ this ->faker ()->unique ()->url ;
499501
500502 return $ contributor ;
501503 }
0 commit comments