private function parseAndCheckFieldsProcess() { foreach ($this->configClass['fields'] as $name => &$field) { if (is_string($field)) { $field = array('type' => $field); } if ($this->configClass['inheritance'] && !isset($field['inherited'])) { $field['inherited'] = false; } } unset($field); foreach ($this->configClass['fields'] as $name => &$field) { if (!is_array($field)) { throw new \RuntimeException(sprintf('The field "%s" of the class "%s" is not a string or array.', $name, $this->class)); } if (!isset($field['type'])) { throw new \RuntimeException(sprintf('The field "%s" of the class "%s" does not have type.', $name, $this->class)); } if (!TypeContainer::has($field['type'])) { throw new \RuntimeException(sprintf('The type "%s" of the field "%s" of the class "%s" does not exists.', $field['type'], $name, $this->class)); } if (!isset($field['dbName'])) { $field['dbName'] = $name; } elseif (!is_string($field['dbName'])) { throw new \RuntimeException(sprintf('The dbName of the field "%s" of the class "%s" is not an string.', $name, $this->class)); } } unset($field); }
public function testResetTypes() { Container::add('testing', 'Mandango\\Tests\\Type\\TestingType'); Container::reset(); $this->assertTrue(Container::has('string')); $this->assertFalse(Container::has('testing')); }