Completed
Pull Request — master (#3)
by Raphaël
05:51 queued 24s
created
tests/Wabel/Services/DetectAppointmentsChangingsServiceTest.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
      * Personal Object to test
30 30
      * @return array
31 31
      */
32
-    private function personalAppointment(){
32
+    private function personalAppointment() {
33 33
         return [
34 34
                     "appointmentId"=> 52,
35 35
                     "startDate"=> "2015-16-07 11:00:00",
@@ -68,23 +68,23 @@  discard block
 block discarded – undo
68 68
 
69 69
     protected function setUp()
70 70
     {
71
-        $certainApiClient =  new CertainApiClient(null,getenv('username'),getenv('password'),getenv('accountCode'));
72
-        $this->certainApiService  = new CertainApiService($certainApiClient);
71
+        $certainApiClient = new CertainApiClient(null, getenv('username'), getenv('password'), getenv('accountCode'));
72
+        $this->certainApiService = new CertainApiService($certainApiClient);
73 73
         $this->appointmentsCertain = new AppointmentsCertain($this->certainApiService);
74
-        $this->certainAppointmentsList = $this->appointmentsCertain->get(getenv('eventCode'),['start_index'=>0,'max_results'=>10])->getResults()->appointments;
74
+        $this->certainAppointmentsList = $this->appointmentsCertain->get(getenv('eventCode'), ['start_index'=>0, 'max_results'=>10])->getResults()->appointments;
75 75
     }
76 76
 
77
-    public function testDetectChangings(){
77
+    public function testDetectChangings() {
78 78
         $detectService = new DetectAppointmentsChangingsService($this->appointmentsCertain);
79 79
         $oldAppointments = $this->certainAppointmentsList;
80 80
         $currentAppoiments = $oldAppointments;
81 81
         unset($currentAppoiments[0]);
82 82
         unset($currentAppoiments[1]);
83
-        $hasChanged = $detectService->hasChanged($oldAppointments,$currentAppoiments);
83
+        $hasChanged = $detectService->hasChanged($oldAppointments, $currentAppoiments);
84 84
         $this->assertTrue($hasChanged);
85 85
     }
86 86
 
87
-    public function testGetListChangings(){
87
+    public function testGetListChangings() {
88 88
         $detectService = new DetectAppointmentsChangingsService($this->appointmentsCertain);
89 89
         $oldAppointments = $this->certainAppointmentsList;
90 90
         $currentAppoiments = $oldAppointments;
@@ -94,14 +94,14 @@  discard block
 block discarded – undo
94 94
         unset($currentAppoiments[0]);
95 95
         unset($currentAppoiments[1]);
96 96
         unset($currentAppoiments[4]);
97
-        $changings = $detectService->getListChangings($oldAppointments,$currentAppoiments);
98
-        $this->assertEquals(4,count($changings));
99
-        $this->assertContains($delete1,$changings);
100
-        $this->assertContains($delete2,$changings);
101
-        $this->assertContains($delete3,$changings);
97
+        $changings = $detectService->getListChangings($oldAppointments, $currentAppoiments);
98
+        $this->assertEquals(4, count($changings));
99
+        $this->assertContains($delete1, $changings);
100
+        $this->assertContains($delete2, $changings);
101
+        $this->assertContains($delete3, $changings);
102 102
     }
103 103
 
104
-    public function testDetectDeleteOrUpdated(){
104
+    public function testDetectDeleteOrUpdated() {
105 105
         $detectService = new DetectAppointmentsChangingsService($this->appointmentsCertain);
106 106
         $oldAppointments = $this->certainAppointmentsList;
107 107
         $oldAppointments[10] = $this->personalAppointment();
@@ -113,19 +113,19 @@  discard block
 block discarded – undo
113 113
         $update1 = $currentAppoiments[10];
114 114
         $currentAppoiments[10]["startDate"] = "2015-17-07 12:00:00";
115 115
         $currentAppoiments[10]["endDate"] = "2015-17-07 12:30:00";
116
-        $changings = $detectService->getListChangings($oldAppointments,$currentAppoiments);
117
-        $listDetected = $detectService->detectDeleteOrUpdatedOrInserted($currentAppoiments,$changings);
118
-        $this->assertEquals(3,count($changings));
119
-        $this->assertArrayHasKey('deleted',$listDetected);
120
-        $this->assertArrayHasKey('updated',$listDetected);
121
-        $this->assertEquals(2,count($listDetected['deleted']));
122
-        $this->assertEquals(1,count($listDetected['updated']));
123
-        $this->assertContains($delete1,$listDetected['deleted']);
124
-        $this->assertContains($delete2,$listDetected['deleted']);
125
-        $this->assertContains($update1,$listDetected['updated']);
116
+        $changings = $detectService->getListChangings($oldAppointments, $currentAppoiments);
117
+        $listDetected = $detectService->detectDeleteOrUpdatedOrInserted($currentAppoiments, $changings);
118
+        $this->assertEquals(3, count($changings));
119
+        $this->assertArrayHasKey('deleted', $listDetected);
120
+        $this->assertArrayHasKey('updated', $listDetected);
121
+        $this->assertEquals(2, count($listDetected['deleted']));
122
+        $this->assertEquals(1, count($listDetected['updated']));
123
+        $this->assertContains($delete1, $listDetected['deleted']);
124
+        $this->assertContains($delete2, $listDetected['deleted']);
125
+        $this->assertContains($update1, $listDetected['updated']);
126 126
     }
127 127
 
128
-    public function testDetectAppointmentsChangings(){
128
+    public function testDetectAppointmentsChangings() {
129 129
         $detectService = new DetectAppointmentsChangingsService($this->appointmentsCertain);
130 130
         $oldAppointments = $this->certainAppointmentsList;
131 131
         $oldAppointments[10] = $this->personalAppointment();
@@ -141,10 +141,10 @@  discard block
 block discarded – undo
141 141
         $update1['dateDetectChanges'] = $time;
142 142
         $currentAppoiments[10]["startDate"] = "2015-17-07 12:00:00";
143 143
         $currentAppoiments[10]["endDate"] = "2015-17-07 12:30:00";
144
-        $listDetected = $detectService->detectAppointmentsChangings($oldAppointments,$currentAppoiments,$time);
145
-        $this->assertContains($delete1,$listDetected['deleted']);
146
-        $this->assertContains($delete2,$listDetected['deleted']);
147
-        $this->assertContains($update1,$listDetected['updated']);
144
+        $listDetected = $detectService->detectAppointmentsChangings($oldAppointments, $currentAppoiments, $time);
145
+        $this->assertContains($delete1, $listDetected['deleted']);
146
+        $this->assertContains($delete2, $listDetected['deleted']);
147
+        $this->assertContains($update1, $listDetected['updated']);
148 148
     }
149 149
 
150 150
 }
151 151
\ No newline at end of file
Please login to merge, or discard this patch.