# |
Jul 17th 2017, 16:36 |
jeremyharris |
you can always turn it into an array if you want, too, ->toArray |
# |
Jul 17th 2017, 16:35 |
jeremyharris |
usually you iterate through the resultset (e.g., items). or if there is a single item, use ->first() |
# |
Jul 17th 2017, 16:35 |
slackebot |
) |
# |
Jul 17th 2017, 16:35 |
aaronc |
Is there a simple way to get the key of this result set object i.e. 'items'? ```Cake\ORM\ResultSet Object ( [items] => Array ( [0] => Cake\ORM\Entity Object ( [id] => 1 [name] => Safari Land/Second Chance [[new]] => [[accessible]] => Array ( [*] => 1 |
# |
Jul 17th 2017, 16:20 |
jeremyharris |
that could just be old stuff |
# |
Jul 17th 2017, 16:19 |
jeremyharris |
or at least, at that time they did |
# |
Jul 17th 2017, 16:19 |
jeremyharris |
yeah they have their own test library it seems |
# |
Jul 17th 2017, 16:18 |
phantomwatson |
Trying to point phpunit to the directory only gets me "file not found" errors. I'm stumped. And I know it has to be something really simple and dumb that I'm doing wrong |
# |
Jul 17th 2017, 16:17 |
phantomwatson |
Yeah, I see references to php_codesniffer having a framework for running phpunit tests to confirm the standards are working as expected, but I haven't managed to find anything in the library's wiki (https://github.com/squizlabs/PHP_CodeSniffer/wiki). |
# |
Jul 17th 2017, 16:16 |
jeremyharris |
maybe the codesniffer lib has some info on how to run those tests |
# |
Jul 17th 2017, 16:15 |
jeremyharris |
although, it looks like those aren’t phpunit tests |
# |
Jul 17th 2017, 16:14 |
jeremyharris |
@phantomwatson you can point to the dir perhaps? vendor/bin/phpunit CakePHP/Tests |
# |
Jul 17th 2017, 16:13 |
stefan |
I didn't use 2.x before so I don't know how it was working. Slack was my last hope. ;) |
# |
Jul 17th 2017, 16:12 |
jeremyharris |
I think you’re right though. I just looked through the code and can’t find detection of hasOne. Perhaps it was removed in the 3.x version of bake — I don’t use hasOne in my 3.x application |
# |
Jul 17th 2017, 16:11 |
jeremyharris |
yes |
# |
Jul 17th 2017, 16:11 |
stefan |
but this is very similar to `hasMany` relationship - isn't that the case? |
# |
Jul 17th 2017, 16:11 |
phantomwatson |
Anyone know how phpunit works with testing php_codesniffer standards? I can't seem to get them to run for cakephp-codesniffer. I clone https://github.com/cakephp/cakephp-codesniffer.git, run `composer install`, then run `vendor/bin/phpunit` and it only runs the tests defined in `vendor/squizlabs/php_codesniffer`. Anyone know how I would get it to run the tests under `CakePHP/Tests`? |
# |
Jul 17th 2017, 16:10 |
jeremyharris |
it might suggest belongsTo first, just say “no” |
# |
Jul 17th 2017, 16:10 |
stefan |
I did. |
# |
Jul 17th 2017, 16:10 |
jeremyharris |
I believe it does detect hasOne automatically if you follow conventions |
# |
Jul 17th 2017, 16:06 |
stefan |
I'm trying to modify bakery and I'm wondering if it's possible to detect `hasOne` relationship automatically? I can't find anything in the source code of the `ModelTask.php` |
# |
Jul 17th 2017, 16:03 |
cleptric |
Hi :slightly_smiling_face: |
# |
Jul 17th 2017, 16:02 |
stefan |
hello |
# |
Jul 17th 2017, 15:27 |
jeremyharris |
only use case is probably tests |
# |
Jul 17th 2017, 15:27 |
neon1024 |
lol ;) |
# |
Jul 17th 2017, 15:26 |
jeremyharris |
yeah you can clear the cache, but once they’re in there, they’re in there |
# |
Jul 17th 2017, 15:26 |
neon1024 |
er `clearDetectorCache` |
# |
Jul 17th 2017, 15:26 |
neon1024 |
I thought so too, with deleteDetectorCache(), but it seems not |
# |
Jul 17th 2017, 15:26 |
jeremyharris |
I thought there was a way to remove detectors, guess not |
# |
Jul 17th 2017, 15:26 |
neon1024 |
Might refactor the tests once I’ve written the code to pass them |
# |
Jul 17th 2017, 15:25 |
neon1024 |
But yes, a proper mock is probably in order |
# |
Jul 17th 2017, 15:25 |
neon1024 |
I just set the detector to return true for mobile tests and false for not mobile test cases :P |
# |
Jul 17th 2017, 15:23 |
jeremyharris |
unless you’re doing integration .. then … env vars I guess :) |
# |
Jul 17th 2017, 15:23 |
jeremyharris |
maybe traditional mock is in order ($request->expects($this->any())->method( |
# |
Jul 17th 2017, 15:21 |
neon1024 |
Ah well #care |
# |
Jul 17th 2017, 15:19 |
neon1024 |
So all subsequent tests are now mobile |
# |
Jul 17th 2017, 15:19 |
neon1024 |
Hah! It stays in global state as it’s static |
# |
Jul 17th 2017, 15:16 |
neon1024 |
Thanks @jeremyharris just ‘mocking’ the detector works just fine |
# |
Jul 17th 2017, 15:12 |
jeremyharris |
we’d be out of the job if whining was all it took :P programmers are expert whiners |
# |
Jul 17th 2017, 15:11 |
neon1024 |
Although that would be nice |
# |
Jul 17th 2017, 15:11 |
neon1024 |
Ah well, moaning about it won’t make the code write itsself |