# |
Mar 11th 2019, 10:42 |
challgren |
Its in cake core |
# |
Mar 11th 2019, 10:42 |
alexdd55 |
what is that fixture injector and manager? can not find an example for that |
# |
Mar 11th 2019, 10:41 |
alexdd55 |
hm… |
# |
Mar 11th 2019, 10:35 |
challgren |
You should copy that to phpunit.xml |
# |
Mar 11th 2019, 10:35 |
challgren |
https://github.com/cakephp/app/blob/master/phpunit.xml.dist |
# |
Mar 11th 2019, 10:34 |
challgren |
but if your fixtureinjector isnt loading correctly the db connection will always fail |
# |
Mar 11th 2019, 10:34 |
alexdd55 |
this is where i got ` // Optional. Set this property to load fixtures to a different test datasource public $connection = ‘test’;`from |
# |
Mar 11th 2019, 10:33 |
challgren |
https://book.cakephp.org/3.0/en/development/testing.html would be the best docs to read |
# |
Mar 11th 2019, 10:33 |
alexdd55 |
thanks.. on it |
# |
Mar 11th 2019, 10:32 |
challgren |
Would be the best spot to look for at basic testing and app setup |
# |
Mar 11th 2019, 10:32 |
challgren |
https://github.com/cakephp/app |
# |
Mar 11th 2019, 10:32 |
challgren |
Im new at the testing side but Its to load the fixtures into the test datasource, its an additional layer on top of phpunit |
# |
Mar 11th 2019, 10:29 |
alexdd55 |
sorry toally new to this |
# |
Mar 11th 2019, 10:29 |
alexdd55 |
@challgren what is the listener for? also have no fixture manager :face_with_monocle: |
# |
Mar 11th 2019, 10:27 |
alexdd55 |
i will check |
# |
Mar 11th 2019, 10:18 |
challgren |
Also make sure your phpunit.xml has listeners setup |
# |
Mar 11th 2019, 10:16 |
slackebot |
<challgren> |
# |
Mar 11th 2019, 10:16 |
challgren |
Is your bootstrap.php in tests/ correct? |
# |
Mar 11th 2019, 10:16 |
alexdd55 |
no matter what i change its always “not found” |
# |
Mar 11th 2019, 10:15 |
challgren |
I have over 100 fixtures and none of mine have any connection set and Im using the default app.php settings |
# |
Mar 11th 2019, 10:15 |
alexdd55 |
its fine |
# |
Mar 11th 2019, 10:14 |
alexdd55 |
i will double check |
# |
Mar 11th 2019, 10:14 |
challgren |
Then something could be wrong like username/password or db doesnt exist |
# |
Mar 11th 2019, 10:14 |
alexdd55 |
even if it would use “default” .. somehow its not finding it |
# |
Mar 11th 2019, 10:13 |
alexdd55 |
don’t wanna use default |
# |
Mar 11th 2019, 10:13 |
alexdd55 |
because it always says “default” was not found.. |
# |
Mar 11th 2019, 10:13 |
challgren |
Why are you adding the connection to the fixture? |
# |
Mar 11th 2019, 10:12 |
alexdd55 |
its already there |
# |
Mar 11th 2019, 10:12 |
challgren |
In your config/app.php look for Datasources and then test |
# |
Mar 11th 2019, 10:08 |
alexdd55 |
any ideas how to dix this? |
# |
Mar 11th 2019, 10:07 |
alexdd55 |
but still get ```App\Test\TestCase\Model\Table\CompaniesTableTest::testInitialize Cake\Datasource\Exception\MissingDatasourceConfigException: The datasource configuration "default" was not found. ``` |
# |
Mar 11th 2019, 10:07 |
alexdd55 |
i add this to the fixture `public $connection = 'test';` |
# |
Mar 11th 2019, 10:05 |
alexdd55 |
but i got stuck with the db connection |
# |
Mar 11th 2019, 10:05 |
alexdd55 |
i am trying to create my first unit tests… EVER :) |
# |
Mar 11th 2019, 10:05 |
alexdd55 |
hi |
# |
Mar 11th 2019, 09:31 |
dereuromark |
@welo.lamacchia did you figure out your afterSave dirty issue? |
# |
Mar 11th 2019, 09:17 |
neon1024 |
Thanks @dereuromark :thumbsup: |
# |
Mar 11th 2019, 09:17 |
neon1024 |
Hoped too much for `array_diff()` ;) |
# |
Mar 11th 2019, 09:17 |
neon1024 |
Cool, I’ll start trying a recursive approach then, with detecting keys and if value is array |
# |
Mar 11th 2019, 09:17 |
neon1024 |
Yeah, I’m taking a TDD approach |
# |
Mar 11th 2019, 09:15 |
dereuromark |
Better manually dive into the nested array and diff more custom then. Sure not trivial to do. But with some test cases along the way you should reach a usable state here. |