--- /dev/null
+<?php
+class SugarContractTest extends AlloServeurTest {
+
+ public function testSynchronize(){
+ $sugarWrapper = $this->getMockBuilder("SugarWrapper")->disableOriginalConstructor()->getMock();
+ $entry_list = array(
+ 'foo'=>array(
+ 'name' => 'bar',
+ 'date_debut_c'=>'2016-04_-02',
+ 'date_fin_c'=>'',
+ 'etat_contrat_c'=>'^signe^',
+ 'link'=>array(
+ SugarContract::CONTRAT_MAINTENANCE_ACCOUNT_RELATIONSHIP => array(
+ array('id'=>"ab8c9e19-e94c-e18e-7e69-48a3f5e5b165")
+ )
+ )
+
+ )
+ );
+
+ $sugarWrapper->expects($this->any())->method("simpleRetrieve")->willReturn($entry_list);
+
+ /** @var SugarWrapper $sugarWrapper*/
+ $sugarContract = new SugarContract($sugarWrapper);
+ $sugarContract->synchronize();
+
+ $pdoContractManager = new PdoContractManager();
+ $contract = $pdoContractManager->getBySugarId('foo');
+ $this->assertEquals('bar',$contract->number);
+ $this->assertEquals(1,$contract->customer_id);
+ }
+}
\ No newline at end of file