|
2 | 2 |
|
3 | 3 | namespace Wikibase\DataModel\Tests\Entity; |
4 | 4 |
|
| 5 | +use PHPUnit_Framework_TestCase; |
5 | 6 | use Wikibase\DataModel\Entity\PropertyId; |
6 | 7 |
|
7 | 8 | /** |
|
15 | 16 | * @licence GNU GPL v2+ |
16 | 17 | * @author Jeroen De Dauw < jeroendedauw@gmail.com > |
17 | 18 | */ |
18 | | -class PropertyIdTest extends \PHPUnit_Framework_TestCase { |
| 19 | +class PropertyIdTest extends PHPUnit_Framework_TestCase { |
19 | 20 |
|
20 | 21 | /** |
21 | 22 | * @dataProvider idSerializationProvider |
@@ -68,6 +69,27 @@ public function invalidIdSerializationProvider() { |
68 | 69 | ); |
69 | 70 | } |
70 | 71 |
|
| 72 | + public function testGetNumericId() { |
| 73 | + $id = new PropertyId( 'P1' ); |
| 74 | + $this->assertSame( 1, $id->getNumericId() ); |
| 75 | + } |
| 76 | + |
| 77 | + public function testGetEntityType() { |
| 78 | + $id = new PropertyId( 'P1' ); |
| 79 | + $this->assertSame( 'property', $id->getEntityType() ); |
| 80 | + } |
| 81 | + |
| 82 | + public function testSerialize() { |
| 83 | + $id = new PropertyId( 'P1' ); |
| 84 | + $this->assertSame( '["property","P1"]', $id->serialize() ); |
| 85 | + } |
| 86 | + |
| 87 | + public function testUnserialize() { |
| 88 | + $id = new PropertyId( 'P1' ); |
| 89 | + $id->unserialize( '["property","P2"]' ); |
| 90 | + $this->assertSame( 'P2', $id->getSerialization() ); |
| 91 | + } |
| 92 | + |
71 | 93 | /** |
72 | 94 | * @dataProvider numericIdProvider |
73 | 95 | */ |
@@ -97,6 +119,7 @@ public function testNewFromNumberWithInvalidNumericId( $number ) { |
97 | 119 |
|
98 | 120 | public function invalidNumericIdProvider() { |
99 | 121 | return array( |
| 122 | + array( 'P1' ), |
100 | 123 | array( '42.1' ), |
101 | 124 | array( 42.1 ), |
102 | 125 | array( 2147483648.1 ), |
|
0 commit comments