# |
Jul 21st 2017, 11:09 |
neon1024 |
Sidesteps the code I’m trying to test it would seem, https://github.com/cakephp/cakephp/blob/master/src/Controller/Component/AuthComponent.php#L621-L623 |
# |
Jul 21st 2017, 11:09 |
slackebot |
Action: neothermic stabs the ORM in cake2 |
# |
Jul 21st 2017, 11:08 |
neothermic |
so what does allow() do to the data that makes it all work? |
# |
Jul 21st 2017, 11:07 |
neon1024 |
It seems I have to call allow() and then dump allowedActions |
# |
Jul 21st 2017, 11:06 |
cleptric |
Doesn’t look like anything is mutated here |
# |
Jul 21st 2017, 11:06 |
cleptric |
``` public function __debugInfo() { return [ 'components' => $this->components, 'implementedEvents' => $this->implementedEvents(), '_config' => $this->getConfig(), ]; } ``` |
# |
Jul 21st 2017, 11:05 |
cleptric |
Is `$controller->Auth` the right instance? |
# |
Jul 21st 2017, 11:04 |
neon1024 |
I find it very confusing that a call to var_dump would change the internal state of the object it’s dumping |
# |
Jul 21st 2017, 11:04 |
neothermic |
Something's modifying your scope |
# |
Jul 21st 2017, 11:04 |
neothermic |
@neon1024 Yeah, I'd be wear of magic there |
# |
Jul 21st 2017, 11:03 |
neon1024 |
Is this down to the accursed magic method `__debugInfo` again? |
# |
Jul 21st 2017, 11:03 |
neon1024 |
With both var_dump calls, ln12 is NULL and ln13 is the array I’m expecting |
# |
Jul 21st 2017, 11:02 |
neon1024 |
I’ve encountered a very strange bug in my test, https://pastebin.com/uzXP8FYB, which if I comment out line 12 of my paste, it makes line 13 empty. |
# |
Jul 21st 2017, 11:02 |
jay |
Post on the issue :slightly_smiling_face: would be good to get a different opinion |
# |
Jul 21st 2017, 11:02 |
neothermic |
maybe -t should take something like `all` as an argument, rather than `--all` being a flag |
# |
Jul 21st 2017, 11:01 |
jay |
If you have the ability to rollback migrations to a certain point, then I would expect to be able to rollback from the starting point without having to find the reference |
# |
Jul 21st 2017, 11:01 |
neothermic |
in our context, a new dev starting today would get a copy of the structure from today, not from 2015 :P |
# |
Jul 21st 2017, 11:01 |
jay |
But you shouldn't limit a tool just because a developer might use it wrong, that's down to them |
# |
Jul 21st 2017, 11:00 |
jay |
depends on when the structure was updated, yes. |
# |
Jul 21st 2017, 11:00 |
neothermic |
a fresh environment should be bootstrapped from a modern copy of the structure, not from the starting structure. |
# |
Jul 21st 2017, 10:59 |
jay |
I disagree. You may want to rollback all migrations to test that all migrations run on a fresh environment. You may have rotated your migrations for a new release, and need to test that they all run correctly before releasing to live. etc.. |
# |
Jul 21st 2017, 10:59 |
neothermic |
(I mean, for context, we have 317 migrations in our project since 2015.. if anyone rolled back all of them on live, we'd have to restore from backups!) |
# |
Jul 21st 2017, 10:58 |
neothermic |
but your development env should be mostly faithful to the live env; so if you'd never rollback ALL migrations on live, you shouldn't be doing that on dev, IMO |
# |
Jul 21st 2017, 10:56 |
jay |
I can see the use case in development environments |
# |
Jul 21st 2017, 10:55 |
neothermic |
(I can't imagine production environments wanting to roll back all migrations(!)) |
# |
Jul 21st 2017, 10:55 |
neothermic |
Hmm, what usecase would --all be handy for? |
# |
Jul 21st 2017, 10:53 |
jay |
I wasn't having a dig, I was just looking to help and try and get some more support |
# |
Jul 21st 2017, 10:53 |
neothermic |
I've tried doing `hour(event_occurred) as \`Stats.hour\``, but that doesn't work (they just appear as `Stats.hour` under the `0` key still) |
# |
Jul 21st 2017, 10:53 |
jay |
@lorenzo I got the 15 day mark from this https://github.com/cakephp/phinx/issues/1128 I can't see any issue that has been responded to since that one |
# |
Jul 21st 2017, 10:53 |
neothermic |
Mrr. Is there any way to get cake to put dynamic fields under the structured data? Lets say I'm pulling data back from the Stats model, and I have a computed field `hour(event_occurred)`, how can I get that to appear under the `Stats` key rather than under the `0` key? :S |
# |
Jul 21st 2017, 10:43 |
lorenzo |
@jay any issue in particular you are referring to? |
# |
Jul 21st 2017, 10:41 |
lorenzo |
So that 15 day mark does not hold |
# |
Jul 21st 2017, 10:41 |
lorenzo |
@jay I've bee merging and responding to issues this week |
# |
Jul 21st 2017, 10:29 |
neon1024 |
Can just create a stub class in the test in the correct namespace :) |
# |
Jul 21st 2017, 10:29 |
neon1024 |
Solved! http://php.net/manual/en/language.namespaces.definitionmultiple.php |
# |
Jul 21st 2017, 10:28 |
neon1024 |
I don’t want the mess of a test app for a single class, along with it’s autoload configuration |
# |
Jul 21st 2017, 10:28 |
jay |
Why do you want to sidestep it? |
# |
Jul 21st 2017, 10:26 |
neon1024 |
I’d like to unit test my plugins controller, but it extends AppController. Is there a neat way to sidestep that in my tests? Or do I need to make a TestApp, like the core does? https://github.com/cakephp/cakephp/blob/master/tests/test_app/TestApp/Controller/AppController.php |
# |
Jul 21st 2017, 10:19 |
jay |
Alright, sounds good. /cc @lorenzo ^ |
# |
Jul 21st 2017, 10:15 |
neon1024 |
@jay Perhaps it’s worth opening a ticket on cakephp/migrations repo? Although it does feel more like an email to core team might be better. Maybe you can get in touch with @megan and ask her if she has any news which could be made into a blog post to keep the community appraised of the current plans with cakephp/phinx and cakephp/migrations. Depends on how far the core team have got with the plans I suppose |
# |
Jul 21st 2017, 10:12 |
braeden |
Love finding typos in a 3rd edition |