1- <?php
1+ <?php declare ( strict_types= 1 );
22
33namespace Wikibase \DataModel \Tests \Statement ;
44
5- use InvalidArgumentException ;
5+ use PHPUnit \ Framework \ TestCase ;
66use Wikibase \DataModel \Entity \EntityId ;
77use Wikibase \DataModel \Entity \ItemId ;
88use Wikibase \DataModel \Statement \StatementGuid ;
1616 * @license GPL-2.0-or-later
1717 * @author Addshore
1818 */
19- class StatementGuidTest extends \ PHPUnit \ Framework \ TestCase {
19+ class StatementGuidTest extends TestCase {
2020
2121 /**
2222 * @dataProvider provideConstructionData
2323 */
24- public function testConstructor ( EntityId $ entityId , $ guid , $ expected ) {
24+ public function testConstructor ( EntityId $ entityId , string $ guid , string $ expected ): void {
2525 $ statementGuid = new StatementGuid ( $ entityId , $ guid );
2626
2727 $ this ->assertSame ( $ expected , $ statementGuid ->getSerialization () );
2828 $ this ->assertEquals ( $ entityId , $ statementGuid ->getEntityId () );
2929 $ this ->assertSame ( $ guid , $ statementGuid ->getGuidPart () );
3030 }
3131
32- public static function provideConstructionData () {
32+ public static function provideConstructionData (): array {
3333 return [
3434 [
3535 new ItemId ( 'q42 ' ),
36- 'D8404CDA-25E4-4334-AF13-A3290BCD9C0N ' ,
36+ 'D8404CDA-25E4-4334-AF13-A3290BCD9C0N ' ,
3737 'Q42$D8404CDA-25E4-4334-AF13-A3290BCD9C0N ' ,
3838 ],
3939 [
@@ -49,24 +49,7 @@ public static function provideConstructionData() {
4949 ];
5050 }
5151
52- /**
53- * @dataProvider provideBadConstruction
54- */
55- public function testBadConstruction ( EntityId $ entityId , $ guid ) {
56- $ this ->expectException ( InvalidArgumentException::class );
57- new StatementGuid ( $ entityId , $ guid );
58- }
59-
60- public static function provideBadConstruction () {
61- $ id = new ItemId ( 'Q1 ' );
62-
63- return [
64- [ $ id , null ],
65- [ $ id , 12345 ],
66- ];
67- }
68-
69- public function provideStatementGuids () {
52+ public function provideStatementGuids (): array {
7053 $ argLists = [];
7154
7255 foreach ( $ this ->provideConstructionData () as $ data ) {
@@ -79,7 +62,7 @@ public function provideStatementGuids() {
7962 /**
8063 * @dataProvider provideStatementGuids
8164 */
82- public function testEquals ( StatementGuid $ statementGuid ) {
65+ public function testEquals ( StatementGuid $ statementGuid ): void {
8366 $ statementGuidCopy = clone $ statementGuid ;
8467 $ this ->assertTrue ( $ statementGuid ->equals ( $ statementGuidCopy ) );
8568 $ this ->assertTrue ( $ statementGuidCopy ->equals ( $ statementGuid ) );
@@ -88,7 +71,7 @@ public function testEquals( StatementGuid $statementGuid ) {
8871 /**
8972 * @dataProvider provideStatementGuids
9073 */
91- public function testNotEquals ( StatementGuid $ statementGuid ) {
74+ public function testNotEquals ( StatementGuid $ statementGuid ): void {
9275 $ notEqualStatementGuid = new StatementGuid ( new ItemId ( 'q9999 ' ), 'someguid ' );
9376 $ this ->assertFalse ( $ statementGuid ->equals ( $ notEqualStatementGuid ) );
9477 $ this ->assertFalse ( $ notEqualStatementGuid ->equals ( $ statementGuid ) );
0 commit comments