testEnvironment = new TestEnvironment(); } public function testCanConstruct() { $this->assertInstanceOf( '\SMW\DataValues\PropertyChainValue', new PropertyChainValue() ); } public function testIsChained() { $this->assertFalse( PropertyChainValue::isChained( 'Foo' ) ); $this->assertTrue( PropertyChainValue::isChained( 'Foo.Bar' ) ); } public function testErrorOnUnchainedValue() { $instance = new PropertyChainValue(); $instance->setUserValue( 'Foo' ); $this->assertNotEmpty( $instance->getErrors() ); } public function testGetLastPropertyChainValue() { $instance = new PropertyChainValue(); $instance->setUserValue( 'Foo.Bar' ); $this->assertEquals( new DIProperty( 'Bar' ), $instance->getLastPropertyChainValue()->getDataItem() ); $this->assertInstanceOf( '\SMWDIBlob', $instance->getDataItem() ); } public function testGetPropertyChainValues() { $instance = new PropertyChainValue(); $instance->setUserValue( 'Foo.Bar' ); $this->assertCount( 1, $instance->getPropertyChainValues() ); } public function testGetWikiValue() { $instance = new PropertyChainValue(); $instance->setUserValue( 'Foo.Bar' ); $this->assertEquals( 'Bar', $instance->getWikiValue() ); } public function testGetShortWikiText() { $instance = new PropertyChainValue(); $instance->setUserValue( 'Foo.Bar' ); $this->assertEquals( 'Bar', $instance->getShortWikiText() ); $this->assertEquals( $this->testEnvironment->replaceNamespaceWithLocalizedText( SMW_NS_PROPERTY, '[[:Property:Bar|Bar]]' ), $instance->getShortWikiText( 'linker' ) ); } public function testGetLongWikiText() { $instance = new PropertyChainValue(); $instance->setUserValue( 'Foo.Bar' ); $this->assertEquals( $this->testEnvironment->replaceNamespaceWithLocalizedText( SMW_NS_PROPERTY, 'Property:Bar' ), $instance->getLongWikiText() ); $this->assertEquals( $this->testEnvironment->replaceNamespaceWithLocalizedText( SMW_NS_PROPERTY, '[[:Property:Bar|Bar]]' ), $instance->getLongWikiText( 'linker' ) ); } public function testGetShortHTMLText() { $instance = new PropertyChainValue(); $instance->setUserValue( 'Foo.Bar' ); $this->assertEquals( 'Bar', $instance->getShortHTMLText() ); } public function testGetLongHTMLText() { $instance = new PropertyChainValue(); $instance->setUserValue( 'Foo.Bar' ); $this->assertEquals( $this->testEnvironment->replaceNamespaceWithLocalizedText( SMW_NS_PROPERTY, 'Property:Bar' ), $instance->getLongHTMLText() ); } }