File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1414 */
1515abstract class HashArrayTest extends \PHPUnit_Framework_TestCase {
1616
17- public abstract function constructorProvider ();
18-
19- /**
20- * Returns the name of the concrete class being tested.
21- *
22- * @since 0.4
23- *
24- * @return string
25- */
26- abstract public function getInstanceClass ();
27-
28- public function instanceProvider () {
29- $ class = $ this ->getInstanceClass ();
30-
31- $ instances = [];
32-
33- foreach ( $ this ->constructorProvider () as $ args ) {
34- $ instances [] = [ new $ class ( array_key_exists ( 0 , $ args ) ? $ args [0 ] : [] ) ];
35- }
36-
37- return $ instances ;
38- }
39-
4017 /**
4118 * @param array $elements
4219 *
Original file line number Diff line number Diff line change 44
55use Hashable ;
66use Wikibase \DataModel \Fixtures \HashArrayElement ;
7+ use Wikibase \DataModel \Fixtures \HashArrayWithoutDuplicates ;
78use Wikibase \DataModel \HashArray ;
89use Wikibase \DataModel \Snak \PropertyNoValueSnak ;
910
1920 */
2021class HashArrayWithoutDuplicatesTest extends HashArrayTest {
2122
22- public function constructorProvider () {
23- $ argLists = [];
24-
25- $ argLists [] = [ HashArrayElement::getInstances () ];
26- $ argLists [] = [ array_merge ( HashArrayElement::getInstances (), HashArrayElement::getInstances () ) ];
27-
28- return $ argLists ;
29- }
30-
31- public function getInstanceClass () {
32- return 'Wikibase\DataModel\Fixtures\HashArrayWithoutDuplicates ' ;
23+ public function instanceProvider () {
24+ return [
25+ [ new HashArrayWithoutDuplicates ( HashArrayElement::getInstances () ) ],
26+ ];
3327 }
3428
3529 public function elementInstancesProvider () {
Original file line number Diff line number Diff line change 3333 */
3434class SnakListTest extends HashArrayTest {
3535
36- /**
37- * @see HashArrayTest::getInstanceClass
38- */
39- public function getInstanceClass () {
40- return 'Wikibase\DataModel\Snak\SnakList ' ;
41- }
42-
4336 public function elementInstancesProvider () {
4437 $ id42 = new PropertyId ( 'P42 ' );
4538
@@ -52,25 +45,24 @@ public function elementInstancesProvider() {
5245 return $ argLists ;
5346 }
5447
55- public function constructorProvider () {
48+ public function instanceProvider () {
5649 $ id42 = new PropertyId ( 'P42 ' );
5750 $ id9001 = new PropertyId ( 'P9001 ' );
5851
5952 return [
60- [],
61- [ [] ],
62- [ [
53+ [ new SnakList () ],
54+ [ new SnakList ( [
6355 new PropertyNoValueSnak ( $ id42 )
64- ] ],
65- [ [
56+ ] ) ],
57+ [ new SnakList ( [
6658 new PropertyNoValueSnak ( $ id42 ),
6759 new PropertyNoValueSnak ( $ id9001 ),
68- ] ],
69- [ [
60+ ] ) ],
61+ [ new SnakList ( [
7062 new PropertyNoValueSnak ( $ id42 ),
7163 new PropertyNoValueSnak ( $ id9001 ),
7264 new PropertyValueSnak ( $ id42 , new StringValue ( 'a ' ) ),
73- ] ],
65+ ] ) ],
7466 ];
7567 }
7668
You can’t perform that action at this time.
0 commit comments