/** * The singleton method * * @return Tracker_TooltipFactory an instance of this factory */ public static function instance() { if (!isset(self::$instance)) { $c = __CLASS__; self::$instance = new $c(); } return self::$instance; }
public function testImport() { $xml = simplexml_load_file(dirname(__FILE__) . '/_fixtures/ImportTrackerSemanticTooltipTest.xml'); $tracker = new MockTracker(); $mapping = array('F8' => 108, 'F9' => 109, 'F16' => 116, 'F14' => 114); $tooltip = Tracker_TooltipFactory::instance()->getInstanceFromXML($xml, $mapping, $tracker); $this->assertEqual(count($tooltip->getFields()), 3); $fields = $tooltip->getFields(); $this->assertTrue(in_array(108, $fields)); $this->assertTrue(in_array(109, $fields)); $this->assertTrue(in_array(116, $fields)); $this->assertFalse(in_array(114, $fields)); }
/** * Returns an instance of Tracker_TooltipFactory * * @return Tracker_TooltipFactory an instance of the factory */ function getSemanticTooltipFactory() { return Tracker_TooltipFactory::instance(); }