Create a Trait that provide a getTableMock($tableName, $methodsToMock = []) method.
Maybe also create a class that extends IntegrationTestCase that pulls that trait in by default.
This is the basic flow to mock a Table Class for a Controller Structure.
$connection = \Cake\Datasource\ConnectionManager::get('test');
$config = ['connection' => $connection];
$UsersTable = $this->getMock(
'App\Model\Table\UsersTable',
['save'],
[$config]
);
$UsersTable->expects($this->once())
->method('save')
->will($this->returnValue(false));
Create a Trait that provide a
getTableMock($tableName, $methodsToMock = [])method.Maybe also create a class that extends IntegrationTestCase that pulls that trait in by default.
This is the basic flow to mock a Table Class for a Controller Structure.