# |
May 3rd 2019, 19:57 |
hollistergraham123 |
@ricksaccous Good advice thanks. |
# |
May 3rd 2019, 18:10 |
ricksaccous |
meh |
# |
May 3rd 2019, 18:10 |
ricksaccous |
it's just a class property, you might want to mess with the constructor to get things working like you want |
# |
May 3rd 2019, 18:10 |
ricksaccous |
as far as editing the $_virtual property |
# |
May 3rd 2019, 18:10 |
ricksaccous |
@hollistergraham123 i'd imagine you just define some setters or getters or whatever in the trait |
# |
May 3rd 2019, 15:15 |
hollistergraham123 |
@admad Thanks! Ended up being an issue with my idea auto creating the file with .ctp :confounded:. I do have a question. Is there a way to have my trait add fields to the $_virtual variable while still allowing my entity to add fields to it? |
# |
May 3rd 2019, 15:01 |
admad |
@hollistergraham123 the namespace need to match folder name for autoloading to work |
# |
May 3rd 2019, 14:56 |
Arckame |
any idea of what's wrong in my approach ? |
# |
May 3rd 2019, 14:54 |
Arckame |
sorry, my english is bad at writing. |
# |
May 3rd 2019, 14:54 |
Arckame |
whole application fail. |
# |
May 3rd 2019, 14:54 |
Arckame |
the plugin is load in the application::bootstrap(), if I load it after parent::bootstrap() the plugin load, but the class cannot be found (The configuration of database is call before the plugin loading) .If I use $this->addPlugin(<pluginName>) before parent::boostrap(), the configuration is missing (loaded after ?), the plugin path is NULL and the |
# |
May 3rd 2019, 14:54 |
Arckame |
I create just an empty one with the corresponding driver class (<plugins>/<pluginName>/src/Database/Driver/<DriverName.php> |
# |
May 3rd 2019, 14:54 |
Arckame |
there is something I misunderstand, I have to implement a new database driver. The solution is to create a plugin (the exemple is the oracle plugin). |
# |
May 3rd 2019, 14:44 |
Arckame |
hello |
# |
May 3rd 2019, 14:42 |
qq |
Can CakePHP deploy to Google App engine? it works fine on Computer engine as virtual machine |
# |
May 3rd 2019, 14:39 |
hollistergraham123 |
Where do I add a custom trait for entities in the folder structure. I tried adding in src/Model/Entity/Traits and namespacing it with App\Model\Entity but I keep getting an unable to find error. The docs only provide an example for plugins. |
# |
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 |