1 | <?php |
||
22 | class SiteLinkTest extends \PHPUnit_Framework_TestCase { |
||
23 | |||
24 | public function testCanConstruct() { |
||
25 | new SiteLink( 'enwiki', 'Wikidata' ); |
||
26 | $this->assertTrue( true ); |
||
27 | } |
||
28 | |||
29 | /** |
||
30 | * @dataProvider siteIdProvider |
||
31 | */ |
||
32 | public function testGetSiteId( $siteId ) { |
||
33 | $siteLink = new SiteLink( $siteId, 'Wikidata' ); |
||
34 | $this->assertEquals( $siteId, $siteLink->getSiteId() ); |
||
35 | } |
||
36 | |||
37 | public function siteIdProvider() { |
||
38 | $argLists = array(); |
||
39 | |||
40 | $argLists[] = array( 'enwiki' ); |
||
41 | $argLists[] = array( 'nlwiki' ); |
||
42 | $argLists[] = array( 'Nyan!' ); |
||
43 | |||
44 | return $argLists; |
||
45 | } |
||
46 | |||
47 | /** |
||
48 | * @dataProvider invalidStringIdentifierProvider |
||
49 | * @expectedException InvalidArgumentException |
||
50 | */ |
||
51 | public function testCannotConstructWithNonStringSiteId( $invalidSiteId ) { |
||
52 | new SiteLink( $invalidSiteId, 'Wikidata' ); |
||
53 | } |
||
54 | |||
55 | public function invalidStringIdentifierProvider() { |
||
56 | return array( |
||
57 | array( null ), |
||
58 | array( true ), |
||
59 | array( 42 ), |
||
60 | array( '' ), |
||
61 | array( array() ), |
||
62 | ); |
||
63 | } |
||
64 | |||
65 | /** |
||
66 | * @dataProvider pageNameProvider |
||
67 | */ |
||
68 | public function testGetPageName( $pageName ) { |
||
69 | $siteLink = new SiteLink( 'enwiki', $pageName ); |
||
70 | $this->assertEquals( $pageName, $siteLink->getPageName() ); |
||
71 | } |
||
72 | |||
73 | public function pageNameProvider() { |
||
74 | $argLists = array(); |
||
75 | |||
76 | $argLists[] = array( 'Wikidata' ); |
||
77 | $argLists[] = array( 'Nyan_Cat' ); |
||
78 | $argLists[] = array( 'NYAN DATA ALL ACROSS THE SKY ~=[,,_,,]:3' ); |
||
79 | |||
80 | return $argLists; |
||
81 | } |
||
82 | |||
83 | /** |
||
84 | * @dataProvider invalidStringIdentifierProvider |
||
85 | * @expectedException InvalidArgumentException |
||
86 | */ |
||
87 | public function testCannotConstructWithNonStringPageName( $invalidPageName ) { |
||
88 | new SiteLink( 'enwiki', $invalidPageName ); |
||
89 | } |
||
90 | |||
91 | /** |
||
92 | * @dataProvider badgesProvider |
||
93 | */ |
||
94 | public function testGetBadges( $badges, $expected ) { |
||
95 | $siteLink = new SiteLink( 'enwiki', 'Wikidata', $badges ); |
||
96 | $this->assertEquals( $expected, $siteLink->getBadges() ); |
||
97 | } |
||
98 | |||
99 | public function badgesProvider() { |
||
135 | |||
136 | /** |
||
137 | * @dataProvider invalidBadgesProvider |
||
138 | * @expectedException InvalidArgumentException |
||
139 | */ |
||
140 | public function testCannotConstructWithInvalidBadges( $invalidBadges ) { |
||
141 | new SiteLink( 'enwiki', 'Wikidata', $invalidBadges ); |
||
142 | } |
||
143 | |||
144 | public function invalidBadgesProvider() { |
||
145 | return array( |
||
158 | |||
159 | /** |
||
160 | * @dataProvider linkProvider |
||
161 | */ |
||
162 | public function testSelfComparisonReturnsTrue( SiteLink $link ) { |
||
169 | |||
170 | public function linkProvider() { |
||
177 | |||
178 | /** |
||
179 | * @dataProvider nonEqualityProvider |
||
180 | */ |
||
181 | public function testGivenNonEqualLinks_equalsReturnsFalse( SiteLink $linkOne, SiteLink $linkTwo ) { |
||
185 | |||
186 | public function nonEqualityProvider() { |
||
206 | |||
207 | public function testCanConstructWithItemIdSet() { |
||
218 | |||
219 | public function testGivenNonItemIdCollectionForBadges_constructorThrowsException() { |
||
223 | |||
224 | } |
||
225 |
This method has been deprecated. The supplier of the class has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.