Example #1
0
 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');
 }
Example #2
0
 /**
  * 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;
     }
 }
Example #4
0
 public function testExistsSchema()
 {
     $this->createTable();
     $reader = new Reader();
     $schema = $reader->getSchema('tests');
     $this->assertNotEmpty($schema);
 }