/** * Method to test removeInstance(). * * @return void * * @covers Windwalker\DataMapper\DataMapperContainer::removeInstance */ public function testRemoveInstance() { $mapperBackup = DataMapperContainer::getInstance('#__content'); DataMapperContainer::removeInstance('#__content'); $mappers = TestHelper::getValue('Windwalker\\DataMapper\\DataMapperContainer', 'instances'); $this->assertArrayNotHasKey('#__content', $mappers); $this->assertNotSame($mapperBackup, DataMapperContainer::getInstance('#__content')); }
/** * Call the DataMapper methods. * * @param string $name Method name to call. * @param array $args The arguments of this method. * * @return mixed Return value of the target method. */ public static function __callStatic($name, $args) { if (empty($args[0]) || !is_string($args[0])) { throw new \InvalidArgumentException('First argument should be table name.'); } $table = array_shift($args); $mapper = DataMapperContainer::getInstance($table); return call_user_func_array(array($mapper, $name), $args); }