Skip to content
Snippets Groups Projects
Commit 78725730 authored by efalcy's avatar efalcy
Browse files

dev #50182: fixture webservice to test comumnication message, add html5 validator

parent 49f8bacd
Branches
Tags
5 merge requests!2080Sandbox detach zf from storm,!2061Master,!1975Master,!1972Dev#50182 1055 seaside meilleur reporting poker 1 generation du rapport html dans bokeh json,!1961Dev#50182 1055 seaside meilleur reporting poker 1 generation du rapport html dans bokeh json
......@@ -127,20 +127,23 @@ class Class_Systeme_Report_Ils extends Class_Systeme_Report_Abstract {
if (!$ils_service = $int_bib->getSIGBComm())
return $this;
$communication_status = $ils_service->test() ? 'ok' : 'error';
$message = $ils_service->test();
$ils_type = preg_replace('/.*_(.*)_Service/',
'$1',
get_class($ils_service));
$report_communication = ['type' => strtolower($ils_type),
'url' => $ils_service->getServerRoot(),
'communication_status' => ($message ? 'error' : 'ok')];
/* if ($message)
$report_communication = array_merge($report_communication, ['error' =>
'<plaintext>'.$message.'</plaintext>']); */
$visitor->visitRecord(['type' => $this->_('Type'),
'url' => $this->_('URL'),
'communication_status' => $this->_('Etat de la communication')],
['type' => strtolower($ils_type),
'url' => $ils_service->getServerRoot(),
'communication_status' => $communication_status]);
'communication_status' => $this->_('Etat de la communication'),
],
$report_communication);
return $this;
}
}
......
......@@ -272,4 +272,10 @@ class Admin_SystemControllerStatusTest extends Admin_AbstractControllerTestCase
$this->assertXPathContentContains('//section//h2', 'Portail');
}
/** @test */
public function pageShouldBeHtml5Valid() {
$this->assertHtml5();
}
}
\ No newline at end of file
......@@ -100,5 +100,33 @@ class ZendAfi_View_Helper_Status_HtmlTest extends ZendAfi_View_Helper_Status_Tes
'//dl/dd[preceding-sibling::dt[text()="Type"]]',
'koha');
}
/** @test */
public function firstILSShouldBeKohaOnError() {
$this->assertXPathContentContains($this->_html,
'//dl/dd[preceding-sibling::dt[text()="Etat de la communication"]]',
'error');
}
/** @test */
public function threeILSShouldBeNanookOnError() {
$this->assertXPathContentContains($this->_html,
'//dl/dd[preceding-sibling::dt[text()="Etat de la communication"]]',
'ok');
}
/** @test */
public function sixILSShouldBeKohaOnError() {
$this->assertXPathContentContains($this->_html,
'//dl/dd[preceding-sibling::dt[text()="Etat de la communication"]]',
'error');
}
}
?>
\ No newline at end of file
......@@ -126,10 +126,11 @@ class ZendAfi_View_Helper_Status_JsonTest extends ZendAfi_View_Helper_Status_Tes
/** @test */
public function firstILSShouldBeKoha() {
public function firstILSShouldBeKohaOnError() {
$this->assertEquals(['type' => 'koha',
'url' => 'http://localhost/koha',
'communication_status' => 'error'],
'communication_status' => 'error',
],
$this->_report['ils'][0]);
}
}
......
......@@ -19,12 +19,13 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
require_once 'tests/fixtures/KohaFixtures.php';
abstract class ZendAfi_View_Helper_Status_TestCase extends ViewHelperTestCase {
protected
$_storm_default_to_volatile = true,
$_helper,
$_helper_class;
$_helper_class,
$service;
protected function _setupProfils() {
......@@ -107,6 +108,11 @@ abstract class ZendAfi_View_Helper_Status_TestCase extends ViewHelperTestCase {
['id' => 2,
'comm_params' => ['url_serveur' => 'http://localhost/koha'],
'comm_sigb' => Class_IntBib::COM_KOHA]);
$this->fixture('Class_IntBib',
['id' => 6,
'comm_params' => ['url_serveur' => 'http://localhost/workingkoha'],
'comm_sigb' => Class_IntBib::COM_KOHA]);
$this->fixture('Class_IntBib',
['id' => 3,
......@@ -122,6 +128,37 @@ abstract class ZendAfi_View_Helper_Status_TestCase extends ViewHelperTestCase {
['id' => 5,
'comm_params' => [],
'comm_sigb' => null]);
Class_AdminVar::newInstanceWithId('KOHA_MULTI_SITES', ['valeur' => '' ]);
$mock_webclient = $this->mock();
$mock_webclient
->whenCalled('open_url')
->with('http://localhost/workingkoha?service=GetRecords&id=1')
->answers(KohaFixtures::xmlGetRecordOneJardinEnfance());
$mock_webclient
->whenCalled('open_url')
->with('http://localhost/koha?service=GetRecords&id=1')
->answers(null);
$service = Class_WebService_SIGB_Koha::getService(['url_serveur' => 'http://localhost/workingkoha',
'id_bib' => 6,
'type' => 5
]);
$service->setWebClient($mock_webclient);
$service = Class_WebService_SIGB_Koha::getService(['url_serveur' => 'http://localhost/koha',
'id_bib' => 2,
'type' => 5
]);
$service->setWebClient($mock_webclient);
/*
Class_WebService_SIGB_Koha::setService(['url_serveur' => 'http://localhost/koha',
'id_bib' => 2,
'type' => 5],$mock_webclient
);
*/
}
......
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