Пример #1
0
 public function testAddIndexWithLimit()
 {
     $table = new \Phinx\Db\Table('table1', array(), $this->adapter);
     $table->addColumn('email', 'string')->save();
     $this->assertFalse($table->hasIndex('email'));
     $table->addIndex('email', array('limit' => 50))->save();
     $this->assertTrue($table->hasIndex('email'));
     $index_data = $this->adapter->query('SELECT SUB_PART FROM information_schema.STATISTICS WHERE TABLE_SCHEMA = "phinx_testing" AND TABLE_NAME = "table1" AND INDEX_NAME = "email"')->fetch(\PDO::FETCH_ASSOC);
     $expected_limit = $index_data['SUB_PART'];
     $this->assertEquals($expected_limit, 50);
 }