@@ -61,28 +61,6 @@ public function validConstructorArgumentsProvider() {
6161 );
6262 }
6363
64- /**
65- * @dataProvider invalidConstructorArgumentsProvider
66- * @expectedException InvalidArgumentException
67- */
68- public function testConstructorWithInvalidArguments (
69- $ mainSnak ,
70- $ qualifiers ,
71- $ references ,
72- $ guid
73- ) {
74- new Statement ( $ mainSnak , $ qualifiers , $ references , $ guid );
75- }
76-
77- public function invalidConstructorArgumentsProvider () {
78- $ snak = new PropertyNoValueSnak ( 1 );
79-
80- return array (
81- array ( $ snak , null , null , false ),
82- array ( $ snak , null , null , 1 ),
83- );
84- }
85-
8664 /**
8765 * @dataProvider instanceProvider
8866 */
@@ -141,11 +119,32 @@ public function testGuidDoesNotAffectHash() {
141119 $ this ->assertEquals ( $ statement0 ->getHash (), $ statement1 ->getHash () );
142120 }
143121
144- public function testSetInvalidGuidCausesException () {
122+ /**
123+ * @dataProvider invalidGuidProvider
124+ * @expectedException InvalidArgumentException
125+ */
126+ public function testGivenInvalidGuid_constructorThrowsException ( $ guid ) {
127+ new Statement ( new PropertyNoValueSnak ( 1 ), null , null , $ guid );
128+ }
129+
130+ /**
131+ * @dataProvider invalidGuidProvider
132+ * @expectedException InvalidArgumentException
133+ */
134+ public function testGivenInvalidGuid_setGuidThrowsException ( $ guid ) {
145135 $ statement = new Statement ( new PropertyNoValueSnak ( 42 ) );
136+ $ statement ->setGuid ( $ guid );
137+ }
146138
147- $ this ->setExpectedException ( 'InvalidArgumentException ' );
148- $ statement ->setGuid ( 42 );
139+ public function invalidGuidProvider () {
140+ $ snak = new PropertyNoValueSnak ( 1 );
141+
142+ return array (
143+ array ( false ),
144+ array ( 1 ),
145+ array ( $ snak ),
146+ array ( new Statement ( $ snak ) ),
147+ );
149148 }
150149
151150 public function instanceProvider () {
0 commit comments