Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
/**
* Copyright (c) 2012-2017, Agence Française Informatique (AFI). All rights reserved.
*
* BOKEH is free software; you can redistribute it and/or modify
* it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
* the Free Software Foundation.
*
* There are special exceptions to the terms and conditions of the AGPL as it
* is applied to this software (see README file).
*
* BOKEH is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
* along with BOKEH; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
class RunLogControllerByDateTest extends CosmoControllerTestCase {
public function setUp() {
parent::setUp();
$this->fixture('Class_CosmoVar',
['id' => 'type_fichier',
'liste' => "0:notices\r\n1:abonnés\r\n2:prêts\r\n3:reservations\r\n4:paniers\r\n5:autorités"]);
$this->fixture('Class_CosmoVar',
['id' => 'import_type_operation',
'liste' => "0:Import incrémentiel\r\n1:Suppression d'exemplaires\r\n2:Import total\r\n3:Suppression fichier d'entête Pergame"]);
$this->fixture('Class_Cosmogramme_Integration',
['id' => 10439,
'traite' => '2018-11-06',
'fichier' => 'integre1212.pan',
'pointeur_reprise' => 0,
'nb_erreurs' => 0,
'nb_warnings' => 0,
'type_operation' => Class_Cosmogramme_Integration::TYPE_OPERATION_TOTAL,
'bib' => $this->fixture('Class_IntBib', ['id' => 3, 'nom_court' => 'test']),
'profil_donnees' => $this->fixture('Class_IntProfilDonnees',
['id' => 678,
'type_fichier' => Class_IntProfilDonnees::FT_AUTHORITY])
]);
$filesystem = $this->mock()
->whenCalled('file_exists')->answers(true)
->whenCalled('filesize')->answers(2299270)
;
Class_Cosmogramme_Integration::setFileSystem($filesystem);

Henri-Damien LAURENT
committed
$this->dispatch('/cosmo/run-log/by-date/date/2018-11-06');
}
public function tearDown() {
Class_Cosmogramme_Integration::setFileSystem(null);
parent::tearDown();
}
/** @test */
public function titleShouldBeJournalDesIntegrations() {
$this->assertXPathContentContains('//h1', 'Journal des intégrations du mardi 6 novembre 2018');
}
/** @test */
public function linkToSyntheseShouldBePresent() {
$this->assertXPath('//a[contains(@href, "/run-log/synthese/id/10439/date/2018-11-06")]');
}

Henri-Damien LAURENT
committed
/** @test */
public function firstColumnTitleShouldBeDate() {
$this->assertXPathContentContains('(//th)[1]', 'Date');
}
/** @test */
public function secondColumnTitleShouldBeBibliotheque() {
$this->assertXPathContentContains('(//th)[2]', 'Bibliothèque');
}
/** @test */
public function thirdColumnTitleShouldBeTypeDeFichier() {
$this->assertXPathContentContains('(//th)[3]', 'Type de fichier');
}
/** @test */
public function dateShouldBePresent() {
$this->assertXPathContentContains('//td', 'mardi 6 novembre 2018');
}
/** @test */
public function libraryShouldBePresent() {
$this->assertXPathContentContains('//td', 'test');
}
/** @test */
public function fileTypeShouldBeAuthorities() {
$this->assertXPathContentContains('//td', 'autorités');
}
/** @test */
public function operationTypeShouldBeTotal() {
$this->assertXPathContentContains('//td', 'Import total');
}
/** @test */
public function fileShouldBeIntegre1212DotPan() {

Henri-Damien LAURENT
committed
$this->assertXPathContentContains('//td',
'integre1212.pan');
}
/** @test */
public function fileSizeShouldBe2245Ko() {
$this->assertXPathContentContains('//td', '2 245');
}
/** @test */
public function fileDownloadLinkShouldBePresent() {
$this->assertXPath('//a[contains(@href, "/run-log/download/id/10439/date/2018-11-06")]');
}
}