--- /dev/null
+<?php
+
+class CustomersControllerTest extends AlloServeurTest {
+
+ /** @var CustomersController */
+ private $customersController;
+
+ protected function setUp(){
+ parent::setUp();
+ $this->customersController = new CustomersController();
+ }
+
+ public function testGetNbCustomers(){
+ $nb_customers = $this->customersController->nbAction();
+ $this->assertEquals(1,$nb_customers);
+ }
+
+ public function testExistsNo(){
+ $this->customersController->setGetParameters(new GetParameters(array('ap_id'=>'toto')));
+ $this->assertFalse($this->customersController->existsAction());
+ }
+
+ public function testExists(){
+ $pdoCustomersManager = new PdoCustomerManager();
+ $customer = new Customer();
+ $customer->ap_id = 'toto';
+ $customer->sugar_id = 0;
+ $pdoCustomersManager->createCustomer($customer);
+ $this->customersController->setGetParameters(new GetParameters(array('ap_id'=>'toto')));
+ $this->assertTrue($this->customersController->existsAction());
+ }
+
+ public function testSearchAction(){
+ $this->customersController->setGetParametersByArray(array('q'=>FixturesData::AP_ID));
+ $search_result = $this->customersController->searchAction();
+ $this->assertEquals(FixturesData::AP_ID,$search_result[0]['ap_id']);
+ }
+
+ public function testInfoAction(){
+ $this->customersController->setGetParametersByArray(array('id'=>1));
+ $customer = $this->customersController->infoAction();
+ $this->assertEquals("VILLE BEAUCAIRE (30)",$customer->name);
+ }
+
+ public function testListAction(){
+ $this->customersController->setGetParametersByArray(array('offset'=>0,'limit'=>50));
+ $info = $this->customersController->listAction();
+ $this->assertEquals("VILLE BEAUCAIRE (30)",$info[0]['name']);
+ }
+
+
+}
\ No newline at end of file