public function testGetInstance() { $instance = PropertyRegistry::getInstance(); $this->assertSame($instance, PropertyRegistry::getInstance()); PropertyRegistry::clear(); $this->assertNotSame($instance, PropertyRegistry::getInstance()); }
protected function tearDown() { ApplicationFactory::clear(); NamespaceExaminer::clear(); PropertyRegistry::clear(); Settings::clear(); Exporter::getInstance()->clear(); parent::tearDown(); }
protected function tearDown() { // If setUp is skipped early this might not be initialized if ($this->testEnvironment !== null) { $this->testEnvironment->tearDown(); } ApplicationFactory::clear(); NamespaceExaminer::clear(); PropertyRegistry::clear(); Settings::clear(); Exporter::getInstance()->clear(); parent::tearDown(); }
/** * @dataProvider preferredLabelValueProvider */ public function testFormatWithPreferredLabel($property, $preferredLabel, $type, $linker, $expected) { // Ensures the mocked instance is injected and registered with the // PropertyRegistry instance \SMW\PropertyRegistry::clear(); $this->propertyLabelFinder = $this->getMockBuilder('\\SMW\\PropertyLabelFinder')->disableOriginalConstructor()->getMock(); $this->propertyLabelFinder->expects($this->any())->method('findPropertyListByLabelAndLanguageCode')->will($this->returnValue(array())); $this->propertyLabelFinder->expects($this->any())->method('findPreferredPropertyLabelByLanguageCode')->will($this->returnValue($preferredLabel)); $this->propertyLabelFinder->expects($this->any())->method('searchPropertyIdByLabel')->will($this->returnValue(false)); $this->testEnvironment->registerObject('PropertyLabelFinder', $this->propertyLabelFinder); $propertyValue = new PropertyValue(); $propertyValue->setOption('smwgDVFeatures', SMW_DV_PROV_LHNT); $propertyValue->setOption(PropertyValue::OPT_CONTENT_LANGUAGE, 'en'); $propertyValue->setOption(PropertyValue::OPT_USER_LANGUAGE, 'en'); $propertyValue->setUserValue($property); $instance = new PropertyValueFormatter($propertyValue); $expected = $this->testEnvironment->getLocalizedTextByNamespace(SMW_NS_PROPERTY, $expected); $this->assertEquals($expected, $instance->format($type, $linker)); \SMW\PropertyRegistry::clear(); }