Provide Easy Mocking For Cake3 Table Classes
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 42/100
Research direction
Start with the CakePHP 3 test setup and the shown getMock flow for a Table class. Determine whether the requested getTableMock($tableName, $methodsToMock = []) trait alone is sufficient or whether an IntegrationTestCase subclass is also needed; done means the example controller-testing flow can mock a Table class and configure method expectations.
Written by the indexing model from the issue text.
Description
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));
- Dominant language
- PHP
- Stars
- 10
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Getting set up
We have not checked this project's setup files yet. Start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from loadsys/CakePHP-Skeleton
-
Difficulty 3/5 1-2 days Newbie friendliness 25/100
loadsys/CakePHP-Skeleton#173 · 1 comment ·
-
3.x enhancement
Difficulty 3/5 1-2 days Newbie friendliness 42/100
loadsys/CakePHP-Skeleton#169 ·
-
Add `loadsys/cakephp-loadsys-theme` as a dev dependencyMay be free again @justinyost claimed this 3757 days ago, and no pull request is open. Open3.x enhancement
loadsys/CakePHP-Skeleton#166 · 1 assignee ·
-
Add Rule Class for Being In the Configure ListMay be free again @justinyost claimed this 3757 days ago, and no pull request is open. Open3.x enhancement
loadsys/CakePHP-Skeleton#164 · 1 assignee ·
-
Update The Script Block To Be At The BottomMay be free again @justinyost claimed this 3757 days ago, and no pull request is open. Open3.x enhancement
loadsys/CakePHP-Skeleton#162 · 1 assignee ·
All issues in loadsys/CakePHP-Skeleton
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
domain/crm-after-sales Platform(Default) priority/high
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
kind/bug status/to verify
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
PHP-CS-Fixer/PHP-CS-Fixer#9867 ·
Maintainers usually reply within 1 day
-
sync-en
Difficulty 1/5 1-3 hours Newbie friendliness 86/100
Maintainers usually reply within 2 days
-
sync-en
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
Maintainers usually reply within 2 days