99use Wikibase \DataModel \Entity \PropertyId ;
1010
1111/**
12+ * @covers Wikibase\DataModel\Entity\DispatchingEntityIdParser
1213 * @covers Wikibase\DataModel\Entity\EntityIdParser
1314 *
15+ * @uses Wikibase\DataModel\Entity\BasicEntityIdParser
16+ *
1417 * @group Wikibase
1518 * @group WikibaseDataModel
1619 *
1720 * @licence GNU GPL v2+
1821 * @author Jeroen De Dauw < jeroendedauw@gmail.com >
1922 */
20- class EntityIdParserTest extends \PHPUnit_Framework_TestCase {
23+ class DispatchingEntityIdParserTest extends \PHPUnit_Framework_TestCase {
24+
25+ private function getBasicParser () {
26+ return new DispatchingEntityIdParser ( BasicEntityIdParser::getBuilders () );
27+ }
2128
2229 /**
23- * @dataProvider idProvider
30+ * @dataProvider entityIdProvider
2431 */
2532 public function testCanParseEntityId ( EntityId $ expected ) {
26- $ actual = $ this ->newParser ()->parse ( $ expected ->getSerialization () );
33+ $ parser = $ this ->getBasicParser ();
34+ $ actual = $ parser ->parse ( $ expected ->getSerialization () );
2735
2836 $ this ->assertEquals ( $ actual , $ expected );
2937 }
3038
31- public function idProvider () {
39+ public function entityIdProvider () {
3240 return array (
3341 array ( new ItemId ( 'q42 ' ) ),
3442 array ( new ItemId ( 'Q1337 ' ) ),
@@ -37,16 +45,13 @@ public function idProvider() {
3745 );
3846 }
3947
40- protected function newParser () {
41- return new DispatchingEntityIdParser ( BasicEntityIdParser::getBuilders () );
42- }
43-
4448 /**
4549 * @dataProvider invalidIdSerializationProvider
50+ * @expectedException \Wikibase\DataModel\Entity\EntityIdParsingException
4651 */
47- public function testCannotParserInvalidId ( $ invalidIdSerialization ) {
48- $ this ->setExpectedException ( ' Wikibase\DataModel\Entity\EntityIdParsingException ' );
49- $ this -> newParser () ->parse ( $ invalidIdSerialization );
52+ public function testCannotParseInvalidId ( $ invalidIdSerialization ) {
53+ $ parser = $ this ->getBasicParser ( );
54+ $ parser ->parse ( $ invalidIdSerialization );
5055 }
5156
5257 public function invalidIdSerializationProvider () {
0 commit comments