diff --git a/src/TestSuite/Fixture/FixtureManager.php b/src/TestSuite/Fixture/FixtureManager.php index 88a786ad8e8..785c86eca66 100644 --- a/src/TestSuite/Fixture/FixtureManager.php +++ b/src/TestSuite/Fixture/FixtureManager.php @@ -251,8 +251,7 @@ protected function _setupTable($fixture, $db, array $sources, $drop = true) $table = $fixture->sourceName(); $exists = in_array($table, $sources); - $hasSchema = $fixture instanceof TableSchemaInterface && $fixture->schema() instanceof TableSchema - || $fixture instanceof TableSchemaAwareInterface && $fixture->getTableSchema() instanceof TableSchema; + $hasSchema = $fixture instanceof TableSchemaInterface && $fixture->getTableSchema() instanceof TableSchema; if (($drop && $exists) || ($exists && !$isFixtureSetup && $hasSchema)) { $fixture->drop($db); diff --git a/src/TestSuite/Fixture/TestFixture.php b/src/TestSuite/Fixture/TestFixture.php index 3b71c7cbcd2..946aec5d39f 100644 --- a/src/TestSuite/Fixture/TestFixture.php +++ b/src/TestSuite/Fixture/TestFixture.php @@ -270,6 +270,10 @@ protected function _schemaFromReflection() */ public function schema(TableSchema $schema = null) { + deprecationWarning( + 'TestFixture::schema() is deprecated. ' . + 'Use TestFixture::setTableSchema()/getTableSchema() instead.' + ); if ($schema) { $this->setTableSchema($schema); } diff --git a/src/TestSuite/TestCase.php b/src/TestSuite/TestCase.php index d8a0fd2c150..7ee2e400502 100644 --- a/src/TestSuite/TestCase.php +++ b/src/TestSuite/TestCase.php @@ -363,10 +363,7 @@ public function assertTextNotContains($needle, $haystack, $message = '', $ignore */ public function assertTags($string, $expected, $fullDebug = false) { - trigger_error( - 'assertTags() is deprecated, use assertHtml() instead.', - E_USER_DEPRECATED - ); + deprecationWarning('TestCase::assertTags() is deprecated. Use TestCase::assertHtml() instead.'); $this->assertHtml($expected, $string, $fullDebug); } diff --git a/tests/TestCase/TestSuite/FixtureManagerTest.php b/tests/TestCase/TestSuite/FixtureManagerTest.php index d4e1da85fd9..24c66ec26fe 100644 --- a/tests/TestCase/TestSuite/FixtureManagerTest.php +++ b/tests/TestCase/TestSuite/FixtureManagerTest.php @@ -146,7 +146,7 @@ public function testFixturizeCoreConstraint() $this->manager->load($test); $table = TableRegistry::get('ArticlesTags'); - $schema = $table->schema(); + $schema = $table->getSchema(); $expectedConstraint = [ 'type' => 'foreign', 'columns' => [ @@ -165,7 +165,7 @@ public function testFixturizeCoreConstraint() $this->manager->load($test); $table = TableRegistry::get('ArticlesTags'); - $schema = $table->schema(); + $schema = $table->getSchema(); $expectedConstraint = [ 'type' => 'foreign', 'columns' => [ @@ -346,7 +346,7 @@ public function testLoadSingle() $table = TableRegistry::get('ArticlesTags'); $results = $table->find('all')->toArray(); - $schema = $table->schema(); + $schema = $table->getSchema(); $expectedConstraint = [ 'type' => 'foreign', 'columns' => [ @@ -371,7 +371,7 @@ public function testLoadSingle() $table = TableRegistry::get('ArticlesTags'); $results = $table->find('all')->toArray(); - $schema = $table->schema(); + $schema = $table->getSchema(); $expectedConstraint = [ 'type' => 'foreign', 'columns' => [ diff --git a/tests/TestCase/TestSuite/TestFixtureTest.php b/tests/TestCase/TestSuite/TestFixtureTest.php index 0a1484c9132..dcc90b263b5 100644 --- a/tests/TestCase/TestSuite/TestFixtureTest.php +++ b/tests/TestCase/TestSuite/TestFixtureTest.php @@ -189,7 +189,7 @@ public function testInitStaticFixture() $Fixture->init(); $this->assertEquals('articles', $Fixture->table); - $schema = $Fixture->schema(); + $schema = $Fixture->getTableSchema(); $this->assertInstanceOf('Cake\Database\Schema\Table', $schema); $fields = $Fixture->fields; @@ -225,7 +225,7 @@ public function testInitImport() 'body', 'published', ]; - $this->assertEquals($expected, $fixture->schema()->columns()); + $this->assertEquals($expected, $fixture->getTableSchema()->columns()); } /** @@ -250,7 +250,7 @@ public function testInitImportModel() 'body', 'published', ]; - $this->assertEquals($expected, $fixture->schema()->columns()); + $this->assertEquals($expected, $fixture->getTableSchema()->columns()); } /** @@ -288,7 +288,7 @@ public function testInitNoImportNoFields() $fixture = new LettersFixture(); $fixture->init(); - $this->assertEquals(['id', 'letter'], $fixture->schema()->columns()); + $this->assertEquals(['id', 'letter'], $fixture->getTableSchema()->columns()); $db = $this->getMockBuilder('Cake\Database\Connection') ->setMethods(['prepare', 'execute']) @@ -324,7 +324,7 @@ public function testCreate() ->method('createSql') ->with($db) ->will($this->returnValue(['sql', 'sql'])); - $fixture->schema($table); + $fixture->setTableSchema($table); $statement = $this->getMockBuilder('\PDOStatement') ->setMethods(['execute', 'closeCursor']) @@ -356,7 +356,7 @@ public function testCreateError() ->method('createSql') ->with($db) ->will($this->throwException(new Exception('oh noes'))); - $fixture->schema($table); + $fixture->setTableSchema($table); $fixture->create($db); } @@ -552,7 +552,7 @@ public function testDrop() ->method('dropSql') ->with($db) ->will($this->returnValue(['sql'])); - $fixture->schema($table); + $fixture->setTableSchema($table); $this->assertTrue($fixture->drop($db)); } @@ -584,7 +584,7 @@ public function testTruncate() ->method('truncateSql') ->with($db) ->will($this->returnValue(['sql'])); - $fixture->schema($table); + $fixture->setTableSchema($table); $this->assertTrue($fixture->truncate($db)); }