22
33namespace Wikibase \DataModel \Tests \Statement ;
44
5- use Exception ;
65use InvalidArgumentException ;
76use Wikibase \DataModel \Statement \StatementGuid ;
87use Wikibase \DataModel \Entity \EntityId ;
@@ -21,74 +20,63 @@ class StatementGuidTest extends \PHPUnit_Framework_TestCase {
2120
2221 /**
2322 * @dataProvider provideConstructionData
24- * @param EntityId $entityId
25- * @param string $guid
26- * @param string $expected
2723 */
2824 public function testConstructor ( EntityId $ entityId , $ guid , $ expected ) {
2925 $ statementGuid = new StatementGuid ( $ entityId , $ guid );
3026
31- $ this ->assertEquals ( $ expected , $ statementGuid ->getSerialization () );
27+ $ this ->assertSame ( $ expected , $ statementGuid ->getSerialization () );
3228 $ this ->assertEquals ( $ entityId , $ statementGuid ->getEntityId () );
3329 }
3430
3531 public function provideConstructionData () {
36- $ argLists = [];
37-
38- $ argLists [] = [
39- new ItemId ( 'q42 ' ),
40- 'D8404CDA-25E4-4334-AF13-A3290BCD9C0N ' ,
41- 'Q42$D8404CDA-25E4-4334-AF13-A3290BCD9C0N '
42- ];
43- $ argLists [] = [
44- new ItemId ( 'Q1234567 ' ),
45- 'D4FDE516-F20C-4154-ADCE-7C5B609DFDFF ' ,
46- 'Q1234567$D4FDE516-F20C-4154-ADCE-7C5B609DFDFF '
32+ return [
33+ [
34+ new ItemId ( 'q42 ' ),
35+ 'D8404CDA-25E4-4334-AF13-A3290BCD9C0N ' ,
36+ 'Q42$D8404CDA-25E4-4334-AF13-A3290BCD9C0N '
37+ ],
38+ [
39+ new ItemId ( 'Q1234567 ' ),
40+ 'D4FDE516-F20C-4154-ADCE-7C5B609DFDFF ' ,
41+ 'Q1234567$D4FDE516-F20C-4154-ADCE-7C5B609DFDFF '
42+ ],
43+ [
44+ new ItemId ( 'Q1 ' ),
45+ 'foo ' ,
46+ 'Q1$foo '
47+ ],
4748 ];
48- $ argLists [] = [
49- new ItemId ( 'Q1 ' ),
50- 'foo ' ,
51- 'Q1$foo '
52- ];
53-
54- return $ argLists ;
5549 }
5650
5751 /**
5852 * @dataProvider provideBadConstruction
5953 */
60- public function testBadConstruction ( $ entityId , $ guid ) {
54+ public function testBadConstruction ( EntityId $ entityId , $ guid ) {
6155 $ this ->setExpectedException ( InvalidArgumentException::class );
6256 new StatementGuid ( $ entityId , $ guid );
6357 }
6458
6559 public function provideBadConstruction () {
66- $ argLists = [];
67-
68- $ argLists [] = [ 'foobar ' , 'foobar ' ];
69- $ argLists [] = [ 'q123 ' , 'foo ' ];
70- $ argLists [] = [ [], 'foo ' ];
71- $ argLists [] = [ new Exception (), 'foo ' ];
72- $ argLists [] = [ 'bar ' , 12345 ];
60+ $ id = new ItemId ( 'Q1 ' );
7361
74- return $ argLists ;
62+ return [
63+ [ $ id , null ],
64+ [ $ id , 12345 ],
65+ ];
7566 }
7667
7768 public function provideStatementGuids () {
78- $ constructionDatas = $ this ->provideConstructionData ();
7969 $ argLists = [];
8070
81- foreach ( $ constructionDatas as $ constructionData ) {
82- $ argLists [] = [ new StatementGuid ( $ constructionData [0 ], $ constructionData [1 ] ) ];
71+ foreach ( $ this -> provideConstructionData () as $ data ) {
72+ $ argLists [] = [ new StatementGuid ( $ data [0 ], $ data [1 ] ) ];
8373 }
8474
8575 return $ argLists ;
8676 }
8777
8878 /**
8979 * @dataProvider provideStatementGuids
90- *
91- * @param StatementGuid $statementGuid
9280 */
9381 public function testEquals ( StatementGuid $ statementGuid ) {
9482 $ statementGuidCopy = clone $ statementGuid ;
@@ -98,8 +86,6 @@ public function testEquals( StatementGuid $statementGuid ) {
9886
9987 /**
10088 * @dataProvider provideStatementGuids
101- *
102- * @param StatementGuid $statementGuid
10389 */
10490 public function testNotEquals ( StatementGuid $ statementGuid ) {
10591 $ notEqualStatementGuid = new StatementGuid ( new ItemId ( 'q9999 ' ), 'someguid ' );
0 commit comments