Browse Source

Remove more deprecated method from TableSchema

antograssiot 8 years ago
parent
commit
2f91d2fe96

+ 7 - 7
tests/TestCase/Database/Schema/MysqlSchemaTest.php

@@ -421,9 +421,9 @@ SQL;
                 'delete' => 'restrict',
             ]
         ];
-        $this->assertEquals($expected['primary'], $result->constraint('primary'));
-        $this->assertEquals($expected['length_idx'], $result->constraint('length_idx'));
-        $this->assertEquals($expected['schema_articles_ibfk_1'], $result->constraint('schema_articles_ibfk_1'));
+        $this->assertEquals($expected['primary'], $result->getConstraint('primary'));
+        $this->assertEquals($expected['length_idx'], $result->getConstraint('length_idx'));
+        $this->assertEquals($expected['schema_articles_ibfk_1'], $result->getConstraint('schema_articles_ibfk_1'));
 
         $this->assertCount(1, $result->indexes());
         $expected = [
@@ -431,7 +431,7 @@ SQL;
             'columns' => ['author_id'],
             'length' => []
         ];
-        $this->assertEquals($expected, $result->index('author_idx'));
+        $this->assertEquals($expected, $result->getIndex('author_idx'));
     }
 
     /**
@@ -446,8 +446,8 @@ SQL;
 
         $schema = new SchemaCollection($connection);
         $result = $schema->describe('schema_articles');
-        $this->assertArrayHasKey('engine', $result->options());
-        $this->assertArrayHasKey('collation', $result->options());
+        $this->assertArrayHasKey('engine', $result->getOptions());
+        $this->assertArrayHasKey('collation', $result->getOptions());
     }
 
     public function testDescribeNonPrimaryAutoIncrement()
@@ -1293,7 +1293,7 @@ SQL;
         ];
         $this->assertEquals(
             $expected,
-            $result->column('data'),
+            $result->getColumn('data'),
             'Field definition does not match for data'
         );
     }

+ 11 - 11
tests/TestCase/Database/Schema/PostgresSchemaTest.php

@@ -405,7 +405,7 @@ SQL;
         ];
         $this->assertEquals(['id'], $result->primaryKey());
         foreach ($expected as $field => $definition) {
-            $this->assertEquals($definition, $result->column($field));
+            $this->assertEquals($definition, $result->getColumn($field));
         }
     }
 
@@ -432,8 +432,8 @@ SQL;
         $connection->execute('DROP TABLE schema_composite');
 
         $this->assertEquals(['id', 'site_id'], $result->primaryKey());
-        $this->assertTrue($result->column('id')['autoIncrement'], 'id should be autoincrement');
-        $this->assertNull($result->column('site_id')['autoIncrement'], 'site_id should not be autoincrement');
+        $this->assertTrue($result->getColumn('id')['autoIncrement'], 'id should be autoincrement');
+        $this->assertNull($result->getColumn('site_id')['autoIncrement'], 'site_id should not be autoincrement');
     }
 
     /**
@@ -498,7 +498,7 @@ SQL;
         ];
         $this->assertEquals(['id'], $result->primaryKey());
         foreach ($expected as $field => $definition) {
-            $this->assertEquals($definition, $result->column($field), "Mismatch in $field column");
+            $this->assertEquals($definition, $result->getColumn($field), "Mismatch in $field column");
         }
     }
 
@@ -528,8 +528,8 @@ SQL;
             ]
         ];
         $this->assertCount(2, $result->constraints());
-        $this->assertEquals($expected['primary'], $result->constraint('primary'));
-        $this->assertEquals($expected['unique_position'], $result->constraint('unique_position'));
+        $this->assertEquals($expected['primary'], $result->getConstraint('primary'));
+        $this->assertEquals($expected['unique_position'], $result->getConstraint('unique_position'));
     }
 
     /**
@@ -578,9 +578,9 @@ SQL;
                 'delete' => 'restrict',
             ]
         ];
-        $this->assertEquals($expected['primary'], $result->constraint('primary'));
-        $this->assertEquals($expected['content_idx'], $result->constraint('content_idx'));
-        $this->assertEquals($expected['author_idx'], $result->constraint('author_idx'));
+        $this->assertEquals($expected['primary'], $result->getConstraint('primary'));
+        $this->assertEquals($expected['content_idx'], $result->getConstraint('content_idx'));
+        $this->assertEquals($expected['author_idx'], $result->getConstraint('author_idx'));
 
         $this->assertCount(1, $result->indexes());
         $expected = [
@@ -588,7 +588,7 @@ SQL;
             'columns' => ['author_id'],
             'length' => []
         ];
-        $this->assertEquals($expected, $result->index('author_idx'));
+        $this->assertEquals($expected, $result->getIndex('author_idx'));
     }
 
     /**
@@ -631,7 +631,7 @@ SQL;
             'columns' => ['group_id', 'grade'],
             'length' => []
         ];
-        $this->assertEquals($expected, $result->index('schema_index_nulls'));
+        $this->assertEquals($expected, $result->getIndex('schema_index_nulls'));
         $connection->execute('DROP TABLE schema_index');
     }
 

+ 7 - 7
tests/TestCase/Database/Schema/SqlserverSchemaTest.php

@@ -408,7 +408,7 @@ SQL;
         ];
         $this->assertEquals(['id'], $result->primaryKey());
         foreach ($expected as $field => $definition) {
-            $this->assertEquals($definition, $result->column($field), 'Failed to match field ' . $field);
+            $this->assertEquals($definition, $result->getColumn($field), 'Failed to match field ' . $field);
         }
     }
 
@@ -435,8 +435,8 @@ SQL;
         $connection->execute('DROP TABLE schema_composite');
 
         $this->assertEquals(['id', 'site_id'], $result->primaryKey());
-        $this->assertNull($result->column('site_id')['autoIncrement'], 'site_id should not be autoincrement');
-        $this->assertTrue($result->column('id')['autoIncrement'], 'id should be autoincrement');
+        $this->assertNull($result->getColumn('site_id')['autoIncrement'], 'site_id should not be autoincrement');
+        $this->assertTrue($result->getColumn('id')['autoIncrement'], 'id should be autoincrement');
     }
 
     /**
@@ -489,9 +489,9 @@ SQL;
                 'delete' => 'cascade',
             ]
         ];
-        $this->assertEquals($expected['primary'], $result->constraint('primary'));
-        $this->assertEquals($expected['content_idx'], $result->constraint('content_idx'));
-        $this->assertEquals($expected['author_idx'], $result->constraint('author_idx'));
+        $this->assertEquals($expected['primary'], $result->getConstraint('primary'));
+        $this->assertEquals($expected['content_idx'], $result->getConstraint('content_idx'));
+        $this->assertEquals($expected['author_idx'], $result->getConstraint('author_idx'));
 
         $this->assertCount(1, $result->indexes());
         $expected = [
@@ -499,7 +499,7 @@ SQL;
             'columns' => ['author_id'],
             'length' => []
         ];
-        $this->assertEquals($expected, $result->index('author_idx'));
+        $this->assertEquals($expected, $result->getIndex('author_idx'));
     }
 
     /**

+ 2 - 1
tests/TestCase/Database/Schema/TableTest.php

@@ -530,7 +530,6 @@ class TableTest extends TestCase
         $this->assertEquals($options, $table->getOptions());
     }
 
-
     /**
      * Test the options method.
      *
@@ -539,6 +538,7 @@ class TableTest extends TestCase
      */
     public function testOptionsDeprecated()
     {
+        $errorLevel = error_reporting(E_ALL & ~E_USER_DEPRECATED);
         $table = new Table('articles');
         $options = [
             'engine' => 'InnoDB'
@@ -546,6 +546,7 @@ class TableTest extends TestCase
         $return = $table->options($options);
         $this->assertInstanceOf('Cake\Database\Schema\Table', $return);
         $this->assertEquals($options, $table->options());
+        error_reporting($errorLevel);
     }
 
     /**

+ 4 - 4
tests/TestCase/TestSuite/FixtureManagerTest.php

@@ -158,7 +158,7 @@ class FixtureManagerTest extends TestCase
             'delete' => 'cascade',
             'length' => []
         ];
-        $this->assertEquals($expectedConstraint, $schema->constraint('tag_id_fk'));
+        $this->assertEquals($expectedConstraint, $schema->getConstraint('tag_id_fk'));
         $this->manager->unload($test);
 
         $this->manager->load($test);
@@ -177,7 +177,7 @@ class FixtureManagerTest extends TestCase
             'delete' => 'cascade',
             'length' => []
         ];
-        $this->assertEquals($expectedConstraint, $schema->constraint('tag_id_fk'));
+        $this->assertEquals($expectedConstraint, $schema->getConstraint('tag_id_fk'));
 
         $this->manager->unload($test);
     }
@@ -358,7 +358,7 @@ class FixtureManagerTest extends TestCase
             'delete' => 'cascade',
             'length' => []
         ];
-        $this->assertEquals($expectedConstraint, $schema->constraint('tag_id_fk'));
+        $this->assertEquals($expectedConstraint, $schema->getConstraint('tag_id_fk'));
         $this->assertCount(4, $results);
 
         $this->manager->unload($test);
@@ -383,7 +383,7 @@ class FixtureManagerTest extends TestCase
             'delete' => 'cascade',
             'length' => []
         ];
-        $this->assertEquals($expectedConstraint, $schema->constraint('tag_id_fk'));
+        $this->assertEquals($expectedConstraint, $schema->getConstraint('tag_id_fk'));
         $this->assertCount(4, $results);
         $this->manager->unload($test);
     }