# |
Feb 1st 2018, 16:35 |
neon1024 |
I went with this in the end which seemed to work okay |
# |
Feb 1st 2018, 16:35 |
neon1024 |
Ahh ok |
# |
Feb 1st 2018, 16:35 |
neon1024 |
https://github.com/davidyell/CakePHP-Seo/blob/master/tests/TestCase/View/Helper/SeoHelperTest.php#L260 |
# |
Feb 1st 2018, 16:35 |
steinkel |
you would mock the protected method, not the Router:url one |
# |
Feb 1st 2018, 16:34 |
neon1024 |
I’d prefer to use a mock, as I don’t need to test the router |
# |
Feb 1st 2018, 16:34 |
neon1024 |
It was the mock that caused that error :slightly_smiling_face: |
# |
Feb 1st 2018, 16:34 |
steinkel |
@neon1024 use a protected _getUrl() method in your helper and mock it |
# |
Feb 1st 2018, 16:23 |
neon1024 |
Well that’s nice and simple |
# |
Feb 1st 2018, 16:23 |
neon1024 |
Ahh, I can just add routes in the test |
# |
Feb 1st 2018, 16:17 |
neon1024 |
Not sure how else my helper can create a url without the router |
# |
Feb 1st 2018, 16:17 |
neon1024 |
Well, https://stackoverflow.com/posts/5961194/revisions |
# |
Feb 1st 2018, 16:15 |
neon1024 |
`1) Seo\Tests\View\Helper\SeoHelperTest::testPageLink with data set #0 (‘Examples’, 1, ‘next’, false, ‘/examples?page=2’) Static method “url” cannot be invoked on mock object` |
# |
Feb 1st 2018, 16:15 |
neon1024 |
Anyone tried mocking the `Router::url()` method? |
# |
Feb 1st 2018, 16:03 |
hmic |
but, it's a neccessity for the PSR interface IMHO and might very well be defined there too, have a look! |
# |
Feb 1st 2018, 16:02 |
hmic |
implement good/thorow tests around it |
# |
Feb 1st 2018, 16:02 |
hmic |
if you use it, mention it and to extra checks on upgrades |
# |
Feb 1st 2018, 16:02 |
hmic |
exactly like that i suppose. |
# |
Feb 1st 2018, 15:44 |
mikesmoniker |
I noticed the docs use `Cake\Http\CallbackStream` in some controller/response examples, but that class is marked `@internal`. I’m used to that annotation meaning something along the lines of _this is part of our internal API and we don’t promise we won’t mess with it_. Anyone know how that plays in Cake? |
# |
Feb 1st 2018, 15:14 |
hmic |
only the cool guys are on slack, abed. |
# |
Feb 1st 2018, 15:09 |
dereuromark |
abed: you might want to express yourself a bit more verbose. |
# |
Feb 1st 2018, 15:06 |
abed |
slack?? |
# |
Feb 1st 2018, 14:38 |
dereuromark |
The table itself already has $table->hasBehavior() :slightly_smiling_face: btqw |
# |
Feb 1st 2018, 14:36 |
kalle.alberg |
https://book.cakephp.org/3.0/en/orm/behaviors.html#accessing-loaded-behaviors |
# |
Feb 1st 2018, 14:36 |
kalle.alberg |
// Check if a specific behavior is loaded. // Remember to omit plugin prefixes. $table->behaviors()->has('CounterCache'); |
# |
Feb 1st 2018, 14:31 |
ooskar1233 |
No problem, glad I could help |
# |
Feb 1st 2018, 14:30 |
amit |
Thanks @ooskar1233 |
# |
Feb 1st 2018, 14:30 |
amit |
Ok let me use that |
# |
Feb 1st 2018, 14:28 |
ooskar1233 |
maybe `class_exists` could help? |
# |
Feb 1st 2018, 14:28 |
ooskar1233 |
okay, I misunderstood you |
# |
Feb 1st 2018, 14:27 |
amit |
Can we check the behavior directly, if it is available or not |
# |
Feb 1st 2018, 14:27 |
amit |
Actually we want to share the behavior between multiple apps so we added that into a plugin and using it |
# |
Feb 1st 2018, 14:25 |
ooskar1233 |
to check if plugin is loaded use `Plugin::loaded('MyPlugin')` |
# |
Feb 1st 2018, 14:25 |
ooskar1233 |
Hello Amit. I think you don't need to access behavior from plugin in purpose to do what you want. |
# |
Feb 1st 2018, 14:24 |
amit |
anyone know how we can do that ? |
# |
Feb 1st 2018, 14:23 |
amit |
I need to check if the plugin is installed than we will add the behavior otherwise not |
# |
Feb 1st 2018, 14:23 |
amit |
We want to access a behavior from a plugin |
# |
Feb 1st 2018, 14:22 |
amit |
Hi Guyz |
# |
Feb 1st 2018, 14:04 |
popperz0r |
ok found it on bootstrap.php :) |
# |
Feb 1st 2018, 14:04 |
popperz0r |
nop |
# |
Feb 1st 2018, 14:03 |
popperz0r |
does .env file isnt loadded automatically? |
# |
Feb 1st 2018, 14:02 |
ooskar1233 |
it may be, yea |