From fc55cb6dfc52ec6ae3b34dce99cc4698a7233bd0 Mon Sep 17 00:00:00 2001 From: llaffont <laurent.laffont@gmail.com> Date: Thu, 23 Jan 2014 12:25:46 +0100 Subject: [PATCH] =?UTF-8?q?Correction=20import=20abonn=C3=A9s=20cosmogramm?= =?UTF-8?q?e=20en=20ascii=20tabul=C3=A9=20Orph=C3=A9e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cosmogramme/php/classes/classe_abonne.php | 2 +- .../php/classes/AbonneIntegrationTest.php | 76 +++++++++++++++++++ 2 files changed, 77 insertions(+), 1 deletion(-) diff --git a/cosmogramme/php/classes/classe_abonne.php b/cosmogramme/php/classes/classe_abonne.php index 40e487d9a42..a923daeb8c5 100644 --- a/cosmogramme/php/classes/classe_abonne.php +++ b/cosmogramme/php/classes/classe_abonne.php @@ -80,7 +80,7 @@ class abonne } - $this->importFicheArray($enreg); + $this->importFicheArray(array_filter($enreg)); } diff --git a/cosmogramme/tests/php/classes/AbonneIntegrationTest.php b/cosmogramme/tests/php/classes/AbonneIntegrationTest.php index d5f3c9e1c0d..a48a08f7adc 100644 --- a/cosmogramme/tests/php/classes/AbonneIntegrationTest.php +++ b/cosmogramme/tests/php/classes/AbonneIntegrationTest.php @@ -100,6 +100,82 @@ class AbonneIntegrationASCIIWithNoUsersInDbTest extends AbonneIntegrationASCIITe +class AbonneIntegrationTabbedASCIIWithNoUsersInDbTest extends AbonneIntegrationASCIITestCase { + public function setup(){ + parent::setup(); + $this->abon_config->setChamps(['NULL', + 'IDABON', + 'NOM', + 'PRENOM', + 'NAISSANCE', + 'DATE_FIN', + 'NUM_CARTE', + 'PASSWORD', + 'NULL', + 'NULL', + 'NULL', + 'NULL', + 'NULL', + 'NULL', + 'NULL', + 'NULL', + 'NULL', + 'MAIL']); + $this->abon_config->importFicheAscii('A 50 ANIMATION JEUNESSE 24/11/2013 50 jsecret8 5 14 10 1'); + $this->user = Class_Users::getFirstAttributeForLastCallOn('save'); + + } + + /** @test **/ + public function abonneSigbMailShouldNotBeNull() { + $this->assertNotNull($this->user->getMail()); + } + + + /** @test **/ + public function idAbonShouldNotBe50() { + $this->assertEquals(50, $this->user->getIdabon()); + } + + + /** @test */ + public function nomShouldBeAnimationJeunesse() { + $this->assertEquals('ANIMATION JEUNESSE', $this->user->getNom()); + } + + + /** @test */ + public function prenomShouldBeEmptyString() { + $this->assertSame('', $this->user->getPrenom()); + } + + + /** @test */ + public function naissanceShouldBeEmptyString() { + $this->assertSame('', $this->user->getNaissance()); + } + + + /** @test */ + public function dateFinShouldBe2013_11_24() { + $this->assertEquals('2013-11-24', $this->user->getDateFin()); + } + + + /** @test */ + public function loginShould50() { + $this->assertEquals('50', $this->user->getLogin()); + } + + + /** @test */ + public function passwordShouldBejsecret8() { + $this->assertEquals('jsecret8', $this->user->getPassword()); + } +} + + + class AbonneIntegrationASCIIWithRoutoInDbTest extends AbonneIntegrationTestCase { protected $user_routo; -- GitLab