# |
Jul 14th 2017, 14:53 |
jeremyharris |
@pedroseco here’s a quick tutorial on git bisect that might help: http://webchick.net/node/99 |
# |
Jul 14th 2017, 14:50 |
jeremyharris |
maybe an API call? a sleep(1000)? could be anything really |
# |
Jul 14th 2017, 14:49 |
pedroseco |
without any fixtures for example. But running plugin tests by using phpunit plugins/MyPlugin/ --filter mymethod |
# |
Jul 14th 2017, 14:49 |
jeremyharris |
find the culprit |
# |
Jul 14th 2017, 14:49 |
jeremyharris |
git bisect might help |
# |
Jul 14th 2017, 14:49 |
pedroseco |
any reason why phpunit suddenly gets too slow when running tests? I started having something like: Time: 8.94 seconds, Memory: 14.00MB |
# |
Jul 14th 2017, 14:48 |
jeremyharris |
unless they were *just* testing the helper in that test - which means it’s not an integration test |
# |
Jul 14th 2017, 14:48 |
jeremyharris |
hah that makes no sense |
# |
Jul 14th 2017, 14:48 |
pedroseco |
hi guys |
# |
Jul 14th 2017, 14:48 |
ericadeefox |
completely frustratingly: I checked FB's integration tests, and they were set up the exact same way as my failing ones were. create a new FBRLH object, disable session check, and send your request. |
# |
Jul 14th 2017, 14:47 |
jeremyharris |
and perhaps that object has a static setter for this particular situation |
# |
Jul 14th 2017, 14:46 |
jeremyharris |
or, see how FB integration tests (if they have some) work. perhaps some other object that creates the helper disables it under certain conditions |
# |
Jul 14th 2017, 14:46 |
jeremyharris |
yes, it’s not static. you might need to overwrite the object and check for the CLI context |
# |
Jul 14th 2017, 14:45 |
ericadeefox |
but it seems every time I do a `$this->get()` request, a _new_ FBRLH object is created that doesn't have the status check disabled, hence I get another 500 w exception. |
# |
Jul 14th 2017, 14:45 |
ericadeefox |
I swear, dang, dude. OK, so, I try this. I create a new FBRLH object and call `disableSessionStatusCheck()`, which is what FB uses to prevent the app from checking if there's an active session or not. (since I'm testing, no, there's not.) |
# |
Jul 14th 2017, 14:43 |
jeremyharris |
disableSessionCheck didn’t work eh? |
# |
Jul 14th 2017, 14:43 |
ericadeefox |
but literally each test throws me this exception and a 500: `Session not active, could not store state.` |
# |
Jul 14th 2017, 14:43 |
ericadeefox |
so, I've got this plugin by Akkaweb. it's a very good plugin and builds a Facebook helper from SDK v4.0.*. so the helper does things like allow the user to create an account or log in via FB, like or share pages from my site, etc. it requires v4 of FB's graph SDK. I'm not trying to test _anything_ specifically to do with this helper or with FB yet, I'm just testing my site as per usual with the tests I've had written for a while now |
# |
Jul 14th 2017, 14:41 |
mikesmoniker |
It also matters whether you’re trying to test something related to FB specifically vs. something else. |
# |
Jul 14th 2017, 14:39 |
slackebot |
that’s a deal-breaker for the SDK). |
# |
Jul 14th 2017, 14:39 |
mikesmoniker |
You might want to elaborate on what you’re doing. The FB SDK has lots of features. Are you trying to test a social login flow or just some random controller action that reads some data from FB? Is this through a Component? Ultimately you probably want to find a spot in the code where there is a clean break between your functionality and the FB implementation and replace the latter with something that doesn’t actually talk to FB ( |
# |
Jul 14th 2017, 14:37 |
slackebot |
that I can perhaps turn these exceptions off from there. it's officially day 4 of me figuring out how to make Facebook work with my integration tests. ? phpendrant; ? |
# |
Jul 14th 2017, 14:37 |
ericadeefox |
I've never built mocks before. essentially, now that I've got the SDK on my site, I can't run my integration tests anymore, because the SDK requires a session to start and our integration testing doesn't actually create true sessions. so I just get thrown exceptions about how I don't have a session going. there's a way to turn that off, but I haven't figured out how to call the function that turns it off. today I'm going to try mocking th |
# |
Jul 14th 2017, 14:34 |
neon1024 |
You might however want a test-case where you mock the Facebook API returning a 404 or 500, so you can code for that |
# |
Jul 14th 2017, 14:33 |
neon1024 |
I haven’t, but I’d certainly mock the response from Facebook. As you don’t want to have your tests hit the live remote API |
# |
Jul 14th 2017, 14:27 |
ericadeefox |
I'll ask it again tho as the day gets started: has anyone got any experience running integration tests while using Facebook's PHP SDK? |
# |
Jul 14th 2017, 14:26 |
diego182 |
if i change the strategy to `select` its way faster, but not shure if is the best option, maybe if someone advise me doing it, i would fell more confortable about it |
# |
Jul 14th 2017, 14:25 |
johan |
Oh, right, I see your original post now :S |
# |
Jul 14th 2017, 14:24 |
diego182 |
@johan @hmlc this query is auto generated on pagination component, i dont know how to change it, i guess its needed to make the pagination logic |
# |
Jul 14th 2017, 14:23 |
jeremyharris |
@awi I think it would be best to re-think the process though, perhaps a validation error or something would be more appropriate |
# |
Jul 14th 2017, 14:21 |
jeremyharris |
or, put the logic elsewhere |
# |
Jul 14th 2017, 14:21 |
johan |
@diego182 That appears to be doing a full table scan, because there's nothing limiting the results from MessageBoard. |
# |
Jul 14th 2017, 14:21 |
jeremyharris |
@awi marshaling has nothing to do with saving really, so throwing an exception would work |
# |
Jul 14th 2017, 14:21 |
ericadeefox |
The Great Facebook SDK Catastrophe of 2017: today I am using mockbuilder for the first time! |
# |
Jul 14th 2017, 14:20 |
awi |
or should I throw some exception? |
# |
Jul 14th 2017, 14:19 |
awi |
like false? |
# |
Jul 14th 2017, 14:19 |
awi |
If there is something happening in beforemarshall and I want to stop saving this bunch of data, what do I need to return? |
# |
Jul 14th 2017, 14:12 |
neon1024 |
Guess I need to make a whole bunch of exception classes now then |
# |
Jul 14th 2017, 14:07 |
hmic |
like i said: you import it to the current namespace. this is: you create it in your current scope. so you can distinguish it from the others. it's perfectly fine that it's the same thing, you just need to be able to scope it |
# |
Jul 14th 2017, 14:06 |
hmic |
yes |
# |
Jul 14th 2017, 14:06 |
neon1024 |
So it’s about scope |