Skip to content

Commit

Permalink
Fix deprecated method use in TestSuite
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Nov 21, 2017
1 parent fe98658 commit 9dca3d2
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions tests/TestCase/TestSuite/TestCaseTest.php
Expand Up @@ -403,21 +403,21 @@ public function testGetMockForModel()

$this->assertInstanceOf('TestApp\Model\Table\PostsTable', $Posts);
$this->assertNull($Posts->save($entity));
$this->assertNull($Posts->table());
$this->assertNull($Posts->getTable());

$Posts = $this->getMockForModel('Posts', ['save']);
$Posts->expects($this->at(0))
->method('save')
->will($this->returnValue('mocked'));
$this->assertEquals('mocked', $Posts->save($entity));
$this->assertEquals('\Cake\ORM\Entity', $Posts->entityClass());
$this->assertEquals('\Cake\ORM\Entity', $Posts->getEntityClass());

$Posts = $this->getMockForModel('Posts', ['doSomething']);
$this->assertInstanceOf('Cake\Database\Connection', $Posts->connection());
$this->assertEquals('test', $Posts->connection()->configName());
$this->assertInstanceOf('Cake\Database\Connection', $Posts->getConnection());
$this->assertEquals('test', $Posts->getConnection()->configName());

$Tags = $this->getMockForModel('Tags', ['doSomething']);
$this->assertEquals('TestApp\Model\Entity\Tag', $Tags->entityClass());
$this->assertEquals('TestApp\Model\Entity\Tag', $Tags->getEntityClass());
}

/**
Expand All @@ -430,7 +430,7 @@ public function testGetMockForModelSecondaryDatasource()
ConnectionManager::alias('test', 'secondary');

$post = $this->getMockForModel(__NAMESPACE__ . '\SecondaryPostsTable', ['save']);
$this->assertEquals('test', $post->connection()->configName());
$this->assertEquals('test', $post->getConnection()->configName());
}

/**
Expand All @@ -451,7 +451,7 @@ public function testGetMockForModelWithPlugin()
$TestPluginComment = $this->getMockForModel('TestPlugin.TestPluginComments', ['save']);

$this->assertInstanceOf('TestPlugin\Model\Table\TestPluginCommentsTable', $TestPluginComment);
$this->assertEquals('\Cake\ORM\Entity', $TestPluginComment->entityClass());
$this->assertEquals('\Cake\ORM\Entity', $TestPluginComment->getEntityClass());
$TestPluginComment->expects($this->at(0))
->method('save')
->will($this->returnValue(true));
Expand All @@ -465,7 +465,7 @@ public function testGetMockForModelWithPlugin()

$TestPluginAuthors = $this->getMockForModel('TestPlugin.Authors', ['doSomething']);
$this->assertInstanceOf('TestPlugin\Model\Table\AuthorsTable', $TestPluginAuthors);
$this->assertEquals('TestPlugin\Model\Entity\Author', $TestPluginAuthors->entityClass());
$this->assertEquals('TestPlugin\Model\Entity\Author', $TestPluginAuthors->getEntityClass());
}

/**
Expand All @@ -483,7 +483,7 @@ public function testGetMockForModelTable()

$result = TableRegistry::get('Comments');
$this->assertInstanceOf('Cake\ORM\Table', $result);
$this->assertEquals('Comments', $Mock->alias());
$this->assertEquals('Comments', $Mock->getAlias());

$Mock->expects($this->at(0))
->method('save')
Expand All @@ -507,9 +507,9 @@ public function testGetMockForModelSetTable()
static::setAppNamespace();

$I18n = $this->getMockForModel('I18n', ['doSomething']);
$this->assertEquals('custom_i18n_table', $I18n->table());
$this->assertEquals('custom_i18n_table', $I18n->getTable());

$Tags = $this->getMockForModel('Tags', ['doSomething']);
$this->assertEquals('tags', $Tags->table());
$this->assertEquals('tags', $Tags->getTable());
}
}

0 comments on commit 9dca3d2

Please sign in to comment.