コード例 #1
0
ファイル: IntegerTest.php プロジェクト: Rmtram/TextDatabase
 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');
 }
コード例 #2
0
ファイル: Memory.php プロジェクト: Rmtram/TextDatabase
 /**
  * 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 = [];
         }
     }
 }
コード例 #3
0
 /**
  * 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;
     }
 }
コード例 #4
0
ファイル: BuildTest.php プロジェクト: Rmtram/TextDatabase
 public function testExistsSchema()
 {
     $this->createTable();
     $reader = new Reader();
     $schema = $reader->getSchema('tests');
     $this->assertNotEmpty($schema);
 }