# |
Sep 3rd 2019, 11:13 |
spriz |
Ah, that might be! :) |
# |
Sep 3rd 2019, 11:12 |
admad |
@spriz don't use xdebug even if you need coverage, use pcov :slightly_smiling_face: |
# |
Sep 3rd 2019, 11:04 |
conehead |
Usually I got xdebug disabled |
# |
Sep 3rd 2019, 11:04 |
conehead |
I will have a look at fixturize. Thanks |
# |
Sep 3rd 2019, 11:04 |
spriz |
With `vendor/bin/phpunit --no-coverage` though |
# |
Sep 3rd 2019, 11:03 |
spriz |
We have ~150 fixtures with 450 tests and 1500 assertions and the full suite is 3:31 :slightly_smiling_face: |
# |
Sep 3rd 2019, 11:01 |
spriz |
and ofc you should not run your tests with `xdebug` enabled unless you need the coverage |
# |
Sep 3rd 2019, 11:00 |
spriz |
it basically only destroy/re-create fixtures if any data has changed from previous test |
# |
Sep 3rd 2019, 11:00 |
spriz |
that is like 3-4x improvement for our saas suite |
# |
Sep 3rd 2019, 11:00 |
spriz |
Aha! Did you try https://github.com/FriendsOfCake/fixturize ? |
# |
Sep 3rd 2019, 10:59 |
conehead |
ah testing against agains actual sql |
# |
Sep 3rd 2019, 10:59 |
spriz |
yeah but unless you changed stuff, that fixtures are creating tables/data in a sql db |
# |
Sep 3rd 2019, 10:59 |
spriz |
or some in-memory thing? |
# |
Sep 3rd 2019, 10:59 |
conehead |
no, just fixtures |
# |
Sep 3rd 2019, 10:59 |
spriz |
@conehead do you have it backed by an actual SQL db? |
# |
Sep 3rd 2019, 10:52 |
conehead |
Just trying to raise the code coverage to > 80%. And usually I like to run all tests before committing. Sucks a little if it takes ages |
# |
Sep 3rd 2019, 10:51 |
conehead |
Yes that is what I am trying to do :P |
# |
Sep 3rd 2019, 10:49 |
neon1024 |
They’re your tests! If you’re confident in your suite, make your changes :slightly_smiling_face: |
# |
Sep 3rd 2019, 10:49 |
conehead |
The controller just does stuff in the background I don't care about |
# |
Sep 3rd 2019, 10:49 |
neon1024 |
Yep, one of my projects the test suite takes 30 minutes |
# |
Sep 3rd 2019, 10:48 |
conehead |
Just doing normal controller tests. But already takes like 10 minutes now |
# |
Sep 3rd 2019, 10:48 |
neon1024 |
Has anyone tried to use `riesenia/cakephp-duplicatable` with hasMany? I’d like to duplicate my hasMany records, but trying to unset the association `id` fields is causing a headache |
# |
Sep 3rd 2019, 10:45 |
neon1024 |
So you can load your dashboard and test `->canSee('#user-details')` etc |
# |
Sep 3rd 2019, 10:45 |
neon1024 |
Using something like Codeception |
# |
Sep 3rd 2019, 10:45 |
neon1024 |
Perhaps you’re looking for acceptance tests? |
# |
Sep 3rd 2019, 10:45 |
neon1024 |
If they test the right stuff is more important to me |
# |
Sep 3rd 2019, 10:44 |
neon1024 |
Dunno about you, but performance of tests aren’t relevant to me |
# |
Sep 3rd 2019, 10:43 |
conehead |
So it's more a performance thing |
# |
Sep 3rd 2019, 10:43 |
conehead |
I am using a dashboard and this dashboard always shows several data (e.g. user details). There are like 10 tables I have to load the fixtures for, although it is not important for the test. So I thought I could just mock it out |
# |
Sep 3rd 2019, 10:38 |
neon1024 |
Doesn’t sound very integrated ;) |
# |
Sep 3rd 2019, 10:37 |
neon1024 |
Why would you need a mock in an integration test? |
# |
Sep 3rd 2019, 10:35 |
conehead |
Ah, I can just set the Helper, even for a integration test? |
# |
Sep 3rd 2019, 10:32 |
neon1024 |
Although helpers may take a View instance as contructor param, so you might need `->setConstructorArgs()` |
# |
Sep 3rd 2019, 10:32 |
neon1024 |
If you’re using PHP Unit that is |
# |
Sep 3rd 2019, 10:31 |
neon1024 |
Sure I tend to use `$helper = $this->getMockBuilder(\App\View\MyHelper::class)->getMock();` |
# |
Sep 3rd 2019, 10:24 |
conehead |
hm anyone know how/if it is possible to Mock Helpers for testing? |
# |
Sep 3rd 2019, 10:13 |
neon1024 |
The entity should have `isNew()` |
# |
Sep 3rd 2019, 10:13 |
val |
How to check whether a new record was created or the existing update in Table::afterSave() in 3.x? |
# |
Sep 3rd 2019, 10:10 |
neon1024 |
Not sure why it doesn’t check it’s an array first :man-shrugging: |
# |
Sep 3rd 2019, 10:10 |
neon1024 |
https://github.com/riesenia/cakephp-duplicatable/blob/master/src/Model/Behavior/DuplicatableBehavior.php#L267 |
# |
Sep 3rd 2019, 10:10 |
neon1024 |
> Warning (2): Invalid argument supplied for foreach() [ROOT/vendor/riesenia/cakephp-duplicatable/src/Model/Behavior/DuplicatableBehavior.php, line 268] |