Skip to content

Commit ebb526e

Browse files
committed
Rewrite of final TestItems class
1 parent d8dbe92 commit ebb526e

1 file changed

Lines changed: 15 additions & 25 deletions

File tree

tests/unit/Entity/TestItems.php

Lines changed: 15 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace Wikibase\DataModel\Tests\Entity;
44

55
use Wikibase\DataModel\Entity\Item;
6-
use Wikibase\DataModel\SiteLink;
76

87
/**
98
* Holds Item objects for testing proposes.
@@ -15,44 +14,35 @@ final class TestItems {
1514

1615
/**
1716
* @since 0.1
17+
*
1818
* @return Item[]
1919
*/
2020
public static function getItems() {
21-
$items = array();
21+
$withTerms = new Item();
22+
$withTerms->setDescription( 'en', 'foo' );
23+
$withTerms->setLabel( 'en', 'bar' );
2224

23-
$items[] = new Item();
25+
$withAlias = new Item();
26+
$withAlias->addAliases( 'en', array( 'foobar', 'baz' ) );
2427

25-
$item = new Item();
26-
27-
$item->setDescription( 'en', 'foo' );
28-
$item->setLabel( 'en', 'bar' );
29-
30-
$items[] = $item;
31-
32-
$item = new Item();
33-
34-
$item->addAliases( 'en', array( 'foobar', 'baz' ) );
35-
36-
$items[] = $item;
37-
38-
$item = new Item();
39-
$item->getSiteLinkList()->addNewSiteLink( 'enwiki', 'spam' );
40-
41-
$items[] = $item;
28+
$withSiteLink = new Item();
29+
$withSiteLink->getSiteLinkList()->addNewSiteLink( 'enwiki', 'spam' );
4230

4331
$item = new Item();
4432
$item->getSiteLinkList()->addNewSiteLink( 'enwiki', 'spamz' );
4533
$item->getSiteLinkList()->addNewSiteLink( 'dewiki', 'foobar' );
46-
4734
$item->setDescription( 'en', 'foo' );
4835
$item->setLabel( 'en', 'bar' );
49-
5036
$item->addAliases( 'en', array( 'foobar', 'baz' ) );
5137
$item->addAliases( 'de', array( 'foobar', 'spam' ) );
5238

53-
$items[] = $item;
54-
55-
return $items;
39+
return array(
40+
'Empty' => new Item(),
41+
'Label and description' => $withTerms,
42+
'Alias only' => $withAlias,
43+
'SiteLink only' => $withSiteLink,
44+
'Everything but statements' => $item,
45+
);
5646
}
5747

5848
}

0 commit comments

Comments
 (0)