Skip to content
Snippets Groups Projects
Commit b76c0670 authored by Ghislain Loas's avatar Ghislain Loas
Browse files

dev #30918 fix tests failrues

parent f77bc65e
Branches
Tags
2 merge requests!1185Dev#30918 developper l interface suggestion d achat vers ws nanook realisation,!1165Dev#30918 developper l interface suggestion d achat vers ws nanook realisation
......@@ -19,7 +19,9 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
class Class_WebService_SIGB_Nanook_PatronInfoReader extends Class_WebService_SIGB_AbstractILSDIPatronInfoReader{
protected $_suggests = [];
protected
$_suggests = [],
$_current_suggest;
/**
* @return Class_WebService_SIGB_Nanook_PatronInfoReader
......@@ -176,8 +178,7 @@ class Class_WebService_SIGB_Nanook_PatronInfoReader extends Class_WebService_SIG
public function endSite($data) {
$library = Class_CodifAnnexe::findFirstBy(['code' => $data]);
$this->_current_suggest->setLibrary($library ? $library->getLibelle() : '');
$this->_current_suggest->setLibrary($data);
}
......@@ -187,12 +188,18 @@ class Class_WebService_SIGB_Nanook_PatronInfoReader extends Class_WebService_SIG
public function endTitle($data) {
$this->_current_suggest->setTitle($data);
parent::endTitle($data);
if($this->_current_suggest)
$this->_current_suggest->setTitle($data);
}
public function endAuthor($data) {
$this->_current_suggest->setAuthor($data);
parent::endAuthor($data);
if($this->_current_suggest)
$this->_current_suggest->setAuthor($data);
}
......
......@@ -95,6 +95,12 @@ abstract class AbstractAbonneControllerSuggestionAchatNanookTestCase extends Abs
$sigb_comm = Class_IntBib::find(3)->getSIGBComm();
$sigb_comm->setWebClient($this->mock_web_client);
}
public function tearDown() {
Class_IntBib::find(3)->getSIGBComm()->setWebClient(null);
parent::tearDown();
}
}
......@@ -126,37 +132,37 @@ class AbonneControllerSuggestionAchatNanookAddTest extends AbstractAbonneControl
/** @test */
public function formShouldContainsTextAreaForComment() {
$this->assertXPath('//form//textarea[@name="comment"]');
$this->assertXPath('//form//textarea[@name="Comment"]');
}
/** @test */
public function formShouldContainsInputForTitle() {
$this->assertXPath('//form//input[@name="title"][@placeholder="ex: Harry Potter à l\'école des sorciers"]');
$this->assertXPath('//form//input[@name="Title"][@placeholder="ex: Harry Potter à l\'école des sorciers"]');
}
/** @test */
public function formShouldContainsInputForAuthor() {
$this->assertXPath('//form//input[@name="author"][@placeholder="ex: Joanne Kathleen Rowling"]');
$this->assertXPath('//form//input[@name="Author"][@placeholder="ex: Joanne Kathleen Rowling"]');
}
/** @test */
public function formShouldContainsInputForIsbn() {
$this->assertXPath('//form//input[@name="isbn"][@placeholder="ex: 2-07-054127-4"]');
$this->assertXPath('//form//input[@name="Isbn"][@placeholder="ex: 2-07-054127-4"]');
}
/** @test */
public function formShouldContainsInputForUrl() {
$this->assertXPath('//form//input[@name="url"][@placeholder="http://www..."]');
$this->assertXPath('//form//input[@name="Url"][@placeholder="http://www..."]');
}
/** @test */
public function formShouldContainsSite() {
$this->assertXPath('//form//input[@name="site"][@value="Tatim bib"][@disabled="1"]', $this->_response->getBody());
$this->assertXPath('//form//input[@name="Site"][@value="Tatim bib"][@disabled="1"]', $this->_response->getBody());
}
}
......
<?php
<<?php
/**
* Copyright (c) 2012, Agence Française Informatique (AFI). All rights reserved.
*
......@@ -262,17 +262,14 @@ abstract class AbonneControllerSuggestionAchatAddFormMultipleBibsAndKohaTestCase
}
public function tearDown() {
Class_IntBib::find(3)->getSIGBComm()->setWebClient(null);
parent::tearDown();
}
}
class AbonneControllerSuggestionAchatAddFormMultipleBibsAndKohaRestfulTest extends AbonneControllerSuggestionAchatAddFormMultipleBibsAndKohaTestCase {
public function setUp() {
......@@ -323,11 +320,17 @@ class AbonneControllerSuggestionAchatAddFormMultipleBibsAndKohaRestfulTest exten
class AbonneControllerSuggestionAchatAddFormMultipleBibsAndKohaRestfulPostTest extends AbonneControllerSuggestionAchatAddFormMultipleBibsAndKohaTestCase {
public function setUp() {
parent::setUp();
$this->mock_web_client
->whenCalled('open_url')
->with('http://plage.com/cgi-bin/koha/ilsdi.pl?service=LookupPatron&id=azerty&id_type=cardnumber')
->answers('<xml><id>234</id></xml>');
->answers('<xml><id>234</id></xml>')
->whenCalled('postData')
->answers(true);
$sigb_comm = Class_IntBib::find(3)->getSIGBComm();
$sigb_comm->setWebClient($this->mock_web_client);
$this->postDispatch('/opac/abonne/suggestion-achat-add',
['Title' => 'Harry Potter',
......
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