# |
Mar 11th 2019, 11:54 |
neon1024 |
Hah, always the way. They want to do it much later when it’ll take three times as long and cost twice as much |
# |
Mar 11th 2019, 11:53 |
alexdd55 |
a colleague is preaching this for years, even wrote a book about TDD… but management never wanted to do it… now they they agreed… and there we are |
# |
Mar 11th 2019, 11:53 |
neon1024 |
.and say don’t be afraid to refactor to make testing easier |
# |
Mar 11th 2019, 11:53 |
neon1024 |
All I can do is wish you luck! |
# |
Mar 11th 2019, 11:52 |
neon1024 |
You’ll end up with complex tests, which are fragile |
# |
Mar 11th 2019, 11:52 |
alexdd55 |
when i start with new stuff.. you are absolutely right |
# |
Mar 11th 2019, 11:52 |
neon1024 |
Because the code will not be written in a testable way |
# |
Mar 11th 2019, 11:52 |
neon1024 |
That’s *the* hardest thing to do |
# |
Mar 11th 2019, 11:52 |
neon1024 |
New helpers, libraries, new functionality, lots of places! |
# |
Mar 11th 2019, 11:52 |
alexdd55 |
need to add tests now for exsiting stuff |
# |
Mar 11th 2019, 11:52 |
neon1024 |
You can TDD any new functionality |
# |
Mar 11th 2019, 11:52 |
neon1024 |
Yes you can, of course you can. |
# |
Mar 11th 2019, 11:51 |
alexdd55 |
can’T do… project is running now for 3 years |
# |
Mar 11th 2019, 11:51 |
neon1024 |
Also if you’re totally new to testing, I would strongly recommend starting with TDD |
# |
Mar 11th 2019, 11:49 |
alexdd55 |
ok.. then i will replace the phpunit version first :zany_face: |
# |
Mar 11th 2019, 11:49 |
neon1024 |
Cake 4 will support PHP Unit 8 :) |
# |
Mar 11th 2019, 11:48 |
neon1024 |
You can strip it out, but you have to do that yourself and load your own fixtures |
# |
Mar 11th 2019, 11:48 |
neon1024 |
This doesn’t work in newer versions |
# |
Mar 11th 2019, 11:48 |
neon1024 |
https://github.com/cakephp/app/blob/master/phpunit.xml.dist#L24 |
# |
Mar 11th 2019, 11:48 |
neon1024 |
Newer versions cause issues with the FixtureInjection event in the config |
# |
Mar 11th 2019, 11:48 |
alexdd55 |
oh wth |
# |
Mar 11th 2019, 11:47 |
neon1024 |
https://github.com/cakephp/app/blob/master/composer.json#L19 |
# |
Mar 11th 2019, 11:47 |
neon1024 |
You’ve got the wrong PHPUNIT :slightly_smiling_face: |
# |
Mar 11th 2019, 11:47 |
alexdd55 |
using cake 3.6 |
# |
Mar 11th 2019, 11:47 |
alexdd55 |
7. |
# |
Mar 11th 2019, 11:47 |
neon1024 |
Using CakePHP 3.7.x |
# |
Mar 11th 2019, 11:47 |
neon1024 |
Or 7 |
# |
Mar 11th 2019, 11:47 |
neon1024 |
Not 8 |
# |
Mar 11th 2019, 11:47 |
neon1024 |
..with phpunit 6 I’d imagine |
# |
Mar 11th 2019, 11:46 |
neon1024 |
..with an existing `phpunit.xml` config |
# |
Mar 11th 2019, 11:46 |
neon1024 |
With `vendor/bin/phpunit` |
# |
Mar 11th 2019, 11:46 |
neon1024 |
You’re testing a whole cake application I guess right? |
# |
Mar 11th 2019, 11:45 |
neon1024 |
Config is a little different for plugins, which is what I’m working on now ;) |
# |
Mar 11th 2019, 11:45 |
neon1024 |
Should be okay then if it matches the repo i’d imagine |
# |
Mar 11th 2019, 11:44 |
alexdd55 |
what shout i set there else then: ``` require dirname(__DIR__) . '/vendor/autoload.php'; require dirname(__DIR__) . '/config/bootstrap.php'; $_SERVER['PHP_SELF'] = '/';``` |
# |
Mar 11th 2019, 11:43 |
alexdd55 |
>That’s /tests/bootstrap.php |
# |
Mar 11th 2019, 11:43 |
neon1024 |
Can you share with us the exact error output |
# |
Mar 11th 2019, 11:43 |
neon1024 |
Also, how do you know the connection is not working? Where are you seeing an error? Which part of your code |
# |
Mar 11th 2019, 11:42 |
neon1024 |
That’s /tests/bootstrap.php |
# |
Mar 11th 2019, 11:42 |
neon1024 |
Have you told your test suite to use the ‘test’ connection? |
# |
Mar 11th 2019, 11:42 |
neon1024 |
Configured the test datasource in /config/app.php and setup the correct connection in bootstrap? |