public function testResetTypes() { IdGeneratorContainer::add('testing', 'Mandango\\Tests\\Id\\TestingIdGenerator'); IdGeneratorContainer::reset(); $this->assertTrue(IdGeneratorContainer::has('native')); $this->assertFalse(IdGeneratorContainer::has('testing')); }
public function mandangoIdGeneratorToMongo($configClass, $id, $indent = 8) { $idGenerator = IdGeneratorContainer::get($configClass['idGenerator']['name']); $code = $idGenerator->getToMongoCode(); $code = str_replace('%id%', $id, $code); $code = static::indentCode($code, $indent); return $code; }
protected function tearDown() { Archive::clear(); IdGeneratorContainer::reset(); TypeContainer::reset(); }
private function parseAndCheckIdGeneratorProcess() { if (!isset($this->configClass['idGenerator'])) { $this->configClass['idGenerator'] = 'native'; } if (!is_array($this->configClass['idGenerator'])) { if (!is_string($this->configClass['idGenerator'])) { throw new \RuntimeException(sprintf('The idGenerator of the class "%s" is not neither an array nor a string.', $this->class)); } $this->configClass['idGenerator'] = array('name' => $this->configClass['idGenerator']); } if (!isset($this->configClass['idGenerator']['options'])) { $this->configClass['idGenerator']['options'] = array(); } elseif (!is_array($this->configClass['idGenerator']['options'])) { throw new \RuntimeException(sprintf('The options key of the idGenerator of the class "%s" is not an array.', $this->class)); } if (!IdGeneratorContainer::has($this->configClass['idGenerator']['name'])) { throw new \RuntimeException(sprintf('The id generator "%s" of the class "%s" does not exist.', $this->configClass['idGenerator']['name'], $this->class)); } }
protected function tearDown() { IdGeneratorContainer::reset(); TypeContainer::reset(); }