Commit 834e98da authored by Patrick Barroca's avatar Patrick Barroca 😁
Browse files

Merge branch 'dev#73934_explo_suivi_bibliondemand_suite_point_hds' into 'master'

dev #73934 : enhance tests

See merge request afi/opacce!2662
parents cdd76253 96b4f7a2
- ticket #73934 : Cosmogramme : amélioration des tests sur l'import de fichier comportant une date
\ No newline at end of file
......@@ -33,17 +33,16 @@ abstract class PhasePrepareIntegrationsWithOAITestCase
->answers(true)
->whenCalled('is_file')
->with ('ftp/my-library.net/transferts/foo/mylibraryincr.txt')
->answers(false)
->with ('ftp/my-library.net/transferts/foo/20180517mylibraryincr.txt')
->answers(true)
->whenCalled('opendir')
->with ('ftp/my-library.net/transferts/foo/')
->answers('dir_pointer')
->whenCalled('readdir')
->with ('dir_pointer')
->answers('mylibraryincr.txt')
->answers('20180517mylibraryincr.txt')
->whenCalled('closedir')
->with ('dir_pointer')
......@@ -53,6 +52,11 @@ abstract class PhasePrepareIntegrationsWithOAITestCase
->with('ftp/my-library.net/transferts/foo/mylibrarytotal.txt',
'ftp/my-library.net/integration/integre1179.pan')
->answers(true)
->whenCalled('rename')
->with('ftp/my-library.net/transferts/foo/20180517mylibraryincr.txt',
'ftp/my-library.net/integration/integre1180.pan')
->answers(true)
->beStrict();
$this->_http_client = $this->mock()
......@@ -186,38 +190,56 @@ class PhasePrepareIntegrationsWithOAITest extends PhasePrepareIntegrationsWithOA
/** @test */
public function twoIntegrationsShouldHaveBeenCreated() {
$this->assertEquals(3, count(Class_Cosmogramme_Integration::findAll()));
public function threeIntegrationsShouldHaveBeenCreated() {
$this->assertEquals(4, count(Class_Cosmogramme_Integration::findAll()));
}
/** @test */
public function firstIntegrationFileShouldBeIntegre1179DotPan() {
$this->assertEquals('integre1179.pan', Class_Cosmogramme_Integration::find(2)->getFichier());
$this->assertEquals('integre1179.pan',
Class_Cosmogramme_Integration::find(2)->getFichier());
}
/** @test */
public function firstIntegrationFileNameShouldBeMyLibraryTotalDotTxt() {
$this->assertEquals('foo/mylibrarytotal.txt', Class_Cosmogramme_Integration::find(2)->getNomFichier());
$this->assertEquals('foo/mylibrarytotal.txt',
Class_Cosmogramme_Integration::find(2)->getNomFichier());
}
/** @test */
public function firstIntegrationKeyShouldBeHash() {
$this->assertEquals('a7be1b1bbdfe70b6fec563334accab3f', Class_Cosmogramme_Integration::find(2)->getHash());
$this->assertEquals('a7be1b1bbdfe70b6fec563334accab3f',
Class_Cosmogramme_Integration::find(2)->getHash());
}
/** @test */
public function secondIntegrationURIShouldBeOAIRepository() {
$this->assertEquals('http://oai-repository.fr/oai', Class_Cosmogramme_Integration::find(3)->getFichier());
public function secondIntegrationShouldBeIncremental() {
$this->assertTrue(Class_Cosmogramme_Integration::find(3)->isIncrement());
}
/** @test */
public function secondIntegrationTransfertDateShouldBeBar() {
$this->assertEquals('2015-03-26', Class_Cosmogramme_Integration::find(3)->getDateTransfert());
public function secondIntegrationFileShouldContainsDate() {
$this->assertContains('[DATE]',
Class_Cosmogramme_Integration::find(3)->getNomFichier());
}
/** @test */
public function thirdIntegrationURIShouldBeOAIRepository() {
$this->assertEquals('http://oai-repository.fr/oai',
Class_Cosmogramme_Integration::find(4)->getFichier());
}
/** @test */
public function thirdIntegrationTransfertDateShouldBeBar() {
$this->assertEquals('2015-03-26',
Class_Cosmogramme_Integration::find(4)->getDateTransfert());
}
......@@ -265,7 +287,9 @@ class PhasePrepareIntegrationsWithOAITest extends PhasePrepareIntegrationsWithOA
class PhasePrepareIntegrationsWithOAIIntegrationAlreadyRegisteredTest extends PhasePrepareIntegrationsWithOAITestCase {
class PhasePrepareIntegrationsWithOAIIntegrationAlreadyRegisteredTest
extends PhasePrepareIntegrationsWithOAITestCase {
protected function _prepareFixtures() {
parent::_prepareFixtures();
$this->fixture('Class_Cosmogramme_Integration',
......@@ -281,7 +305,7 @@ class PhasePrepareIntegrationsWithOAIIntegrationAlreadyRegisteredTest extends Ph
/** @test */
public function oneIntegrationShouldHaveBeenCreated() {
$this->assertEquals(3, count(Class_Cosmogramme_Integration::findAll()));
$this->assertEquals(4, count(Class_Cosmogramme_Integration::findAll()));
}
}
......
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