public function testFieldAttributeWithIdInAutoIncrementIsTrue() { $this->createTable(true); $reader = new Reader(); $schema = $reader->getSchema('tests'); $property = $schema[0]; $attr = $property['attributes']; $this->assertTrue($attr['autoIncrement'], 'bad!! attr id of autoIncrement false'); }
/** * setup load storage. */ private function initializeStorage() { if (false === $this->loaded) { $reader = new Reader(); $items = $reader->throws(false)->getStorage($this->table); if (false !== $items) { $this->items = $items; } else { $this->items = []; } } }
/** * setup load schema. */ private function initialize() { $reader = new Reader(); $schema = $reader->getSchema($this->table); foreach ($schema as $variable) { if (!is_a($variable['type'], Variable::class, true)) { throw new NotVariableClassException('not variable class ' . $variable['type']); } $name = $variable['name']; /** @var Variable $variableObject */ $variableObject = new $variable['type']($name); $refMethod = new \ReflectionMethod($variableObject, 'setAttributes'); $refMethod->setAccessible(true); $refMethod->invoke($variableObject, $variable['attributes']); $this->fields[$name] = $variableObject; } }
public function testExistsSchema() { $this->createTable(); $reader = new Reader(); $schema = $reader->getSchema('tests'); $this->assertNotEmpty($schema); }