Log message #4185488

# At Username Text
# May 3rd 2019, 14:26 maymeow yes maybe later ill implemet this. but for now just need do simple controller tests with `$this->assertResponseContains($profile->display_name);` for example and this is problem when there is missing relationship between model
# May 3rd 2019, 14:23 maymeow :slightly_smiling_face:
# May 3rd 2019, 14:23 neon1024 ..and we’re back to the beginning! 8)
# May 3rd 2019, 14:23 neon1024 As above.
# May 3rd 2019, 14:23 maymeow And there are created right relationships between them
# May 3rd 2019, 14:22 neon1024 Using a test to ensure database contents isn’t really a test, as the whole point of a fixture is to fix your database data
# May 3rd 2019, 14:21 maymeow Just need to ensure that in time of test in database exists everything what I need (in my case user article and profile)
# May 3rd 2019, 14:20 maymeow Hmm
# May 3rd 2019, 14:20 neon1024 Depends how much time you have to maintain a test suite I suppose
# May 3rd 2019, 14:20 neon1024 You could assert getTarget(), getSource() etc I suppose
# May 3rd 2019, 14:19 neon1024 etc
# May 3rd 2019, 14:19 neon1024 `$this->assertSame($result->getClassName(), 'Users')`
# May 3rd 2019, 14:18 neon1024 `$this->assertInstanceOf($result, \Cake\ORM\Association::class)`
# May 3rd 2019, 14:17 neon1024 ..and assert the response
# May 3rd 2019, 14:17 neon1024 The unit test for the association would literally be `$articlesTable->getAssociation('Users')`
# May 3rd 2019, 14:16 maymeow I never used codeception before
# May 3rd 2019, 14:16 neon1024 ..and you have an acceptance test-case to ensure that there is a profile data in the article view template
# May 3rd 2019, 14:15 neon1024 You have a test-case to ensure there is an association between Articles and Users
# May 3rd 2019, 14:15 neon1024 Or it sounds like two tests
# May 3rd 2019, 14:15 neon1024 We use Codeception for that
# May 3rd 2019, 14:15 neon1024 Sounds like an acceptance test
# May 3rd 2019, 14:14 maymeow For example test article view that belongs to user ... User need to have profile which is showing on page otherwise I'll f profile missing it's return error 500
# May 3rd 2019, 14:12 neon1024 I can’t see why you’d want to test a model association anyway
# May 3rd 2019, 14:12 neon1024 I don’t know what that is, sorry
# May 3rd 2019, 14:12 maymeow It would be good to have something like laravel factories for testing :) @neon1024
# May 3rd 2019, 13:54 neon1024 Which would be more of an integration test, but would be less fragile
# May 3rd 2019, 13:54 neon1024 Or I’d build a query object, with contains and assert that the query object contained the correct associations
# May 3rd 2019, 13:53 neon1024 Then I’d update my test every single time I changed an association in that table
# May 3rd 2019, 13:53 neon1024 If I needed to test an association, I would just read the association config array and assert it
# May 3rd 2019, 13:47 maymeow Is there any good practices how to test model with relationships??? (fixtures don't have relations defined).. it is defined here user_id for example but if i need remove id from related fixture because of postgres test its not relevant. how do you guys testing actions that reqire related models?
# May 3rd 2019, 12:40 Arckame thank you
# May 3rd 2019, 12:39 Arckame but i will try a plugin, my first idea was probably not the best.
# May 3rd 2019, 12:39 Arckame yep, but working as a plugin, I had in mind something like create a Database/Driver/<driver>.php in my src folder.
# May 3rd 2019, 12:36 admad Arckame: that's how https://github.com/CakeDC/cakephp-oracle-driver :slightly_smiling_face:
# May 3rd 2019, 12:33 Arckame Any idea about how to properly implement a new database driver in Cake 3.7 ?
# May 3rd 2019, 12:30 Arckame hello
# May 3rd 2019, 11:55 admad @kgb.acct.personal you can't change the query string variable. You would have to use your own paginator class and helper for that
# May 3rd 2019, 11:54 martin I was unable to find it, also checked the saved entity but also not in there
# May 3rd 2019, 11:53 admad it should be within that entity
# May 3rd 2019, 11:53 martin hmm it is a validation error in a relation. That should also be showed there I guess?
# May 3rd 2019, 11:48 martin I hate errors like this, it has an error during save, but it does not tell what the error is :(