Closed jamesspittal closed 9 years ago
I've started investigating why this test failed:
1) SEOstatsTest\Services\Google\GooglePagespeedTest::testSimpleMethodeTest with data set #2 ('getPagespeedScore', '2014', 90)
Failed asserting that 'n.a.' matches expected 90.
Hitting a bit of a brick wall because \SEOstats\Services\Google::getPagespeedScore($url)
definitely seems to work as expected.
In short, the problem with first pull request as related to the location of the "score" metric sitting in a different location within the v1 JSON schema versus v2 JSON schema.
This didn't affect the actual production use of \SEOstats\Services\Google::getPagespeedScore($url)
because that was returning the correct values but it was causing the ('getPagespeedScore', '2014', 90)
test to return n.a.
because it couldn't find the score in the new location and it wasn't checking the old location ($ret->score
).
So, I added some "backwards compatibility".
Hope this helps.
Upgrade to PageSpeed Insights API v2 (as opposed to v1) and implement support for the 'strategy' query string which can be set as either 'desktop' or 'mobile' depending upon whether you want the mobile pagespeed data or desktop pagespeed data.