Commit 0af87c95 authored by efalcy's avatar efalcy
Browse files

Merge branch 'fix_fnac_tests' into 'hotline'

Fix FNAC tests

See merge request !2758
parents 33a0965e a5b392e3
Pipeline #4696 passed with stage
in 47 minutes and 47 seconds
......@@ -52,11 +52,12 @@ class Class_WebService_Fnac extends Class_WebService_Abstract {
return '';
$suite = $this->httpGet($url_lire_la_suite);
return strip_tags($this->extractResumeFromHTML($suite));
return trim(strip_tags($this->extractResumeFromHTML($suite)));
}
public function getUrlLireLaSuite($data) {
xdebug_break();
$pos = ($pos = striPos($data,"summary")) ? $pos : striPos($data, 'resume');
if(!$pos)
return '';
......@@ -71,7 +72,7 @@ class Class_WebService_Fnac extends Class_WebService_Abstract {
if($pos = striPos($html, 'resMarkContent'))
return $this->extractResumeFormBlk($html);
if ($pos = striPos($html, "avisEdContent"))
if ($pos = striPos($html, 'id="Opinions"'))
return $this->extractLireLaSuiteDivAvisEditeurFromHTML($html);
if ($pos = striPos($html, "ficheResume"))
......@@ -122,7 +123,10 @@ class Class_WebService_Fnac extends Class_WebService_Abstract {
public function extractLireLaSuiteDivAvisEditeurFromHTML($html) {
$pos = strPos($html, "avisEdContent") + 15;
$pos = strPos($html, 'id="Opinions">') + 15;
$pos = strPos($html, '<div class="whiteContent', $pos) + 25;
$pos = strPos($html, '>', $pos) + 1;
$posfin = strPos($html, "</div>", $pos);
$resume = substr($html, $pos, ($posfin-$pos));
return trim($resume);
......
This diff is collapsed.
......@@ -41,7 +41,7 @@ abstract class FnacTestCase extends PHPUnit_Framework_TestCase {
class FnactHarryPotterTest extends FnacTestCase {
class FnacHarryPotterTest extends FnacTestCase {
public function setup() {
parent::setUp();
......@@ -90,9 +90,9 @@ class FnacMilleniumTest extends FnacTestCase {
/** @test */
public function getResumeShouldFetchItFromPotterSuite() {
public function getResumeShouldFetchItFromMilleniumSuite() {
$resume = $this->_fnac->getResume('978-2-7427-6501-0');
$this->assertEquals('Une enquête sur un réseau de prostitution dévoile des secrets d\'espionnage et un lourd passé familial.',
$this->assertEquals('Tandis que Lisbeth Salander coule des journées supposées tranquilles aux Caraïbes',
$resume);
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment