5
5
namespace App \Tests \Functional \Controller \Admin ;
6
6
7
7
use App \Tests \Functional \Traits \EventTrait ;
8
+ use App \Tests \Functional \Traits \LocationTrait ;
8
9
use Sulu \Bundle \TestBundle \Testing \SuluTestCase ;
9
10
use Symfony \Bundle \FrameworkBundle \KernelBrowser ;
10
11
use Symfony \Component \HttpFoundation \Response ;
11
12
12
13
class EventControllerTest extends SuluTestCase
13
14
{
14
15
use EventTrait;
16
+ use LocationTrait;
15
17
16
18
/**
17
19
* @var KernelBrowser
@@ -64,6 +66,8 @@ public function testGet(): void
64
66
65
67
public function testPost (): void
66
68
{
69
+ $ location = $ this ->createLocation ('Sulu HQ ' );
70
+
67
71
$ this ->client ->request (
68
72
'POST ' ,
69
73
'/admin/api/events?locale=de ' ,
@@ -73,7 +77,7 @@ public function testPost(): void
73
77
'startDate ' => '2019-01-01 12:00 ' ,
74
78
'endDate ' => '2019-01-02 12:00 ' ,
75
79
'description ' => 'Sulu is really awesome ' ,
76
- 'location ' => ' Dornbirn ' ,
80
+ 'locationId ' => $ location -> getId () ,
77
81
]
78
82
);
79
83
@@ -90,7 +94,7 @@ public function testPost(): void
90
94
$ this ->assertSame ('2019-01-01T12:00:00 ' , $ result ['startDate ' ]);
91
95
$ this ->assertSame ('2019-01-02T12:00:00 ' , $ result ['endDate ' ]);
92
96
$ this ->assertSame ('Sulu is really awesome ' , $ result ['description ' ]);
93
- $ this ->assertSame (' Dornbirn ' , $ result ['location ' ]);
97
+ $ this ->assertSame ($ location -> getId () , $ result ['locationId ' ]);
94
98
95
99
$ result = $ this ->findEventById ($ result ['id ' ], 'de ' );
96
100
@@ -103,7 +107,7 @@ public function testPost(): void
103
107
$ this ->assertNotNull ($ result ->getEndDate ());
104
108
$ this ->assertSame ('2019-01-02T12:00:00 ' , $ result ->getEndDate ()->format ('Y-m-d\TH:i:s ' ));
105
109
$ this ->assertSame ('Sulu is really awesome ' , $ result ->getDescription ());
106
- $ this ->assertSame (' Dornbirn ' , $ result ->getLocation ());
110
+ $ this ->assertSame ($ location -> getId () , $ result ->getLocationId ());
107
111
}
108
112
109
113
public function testPostNullValues (): void
@@ -146,6 +150,7 @@ public function testPostNullValues(): void
146
150
public function testPut (): void
147
151
{
148
152
$ event = $ this ->createEvent ('Symfony ' , 'de ' );
153
+ $ location = $ this ->createLocation ('Sulu HQ ' );
149
154
150
155
$ this ->client ->request (
151
156
'PUT ' ,
@@ -156,7 +161,7 @@ public function testPut(): void
156
161
'startDate ' => '2019-01-01 12:00 ' ,
157
162
'endDate ' => '2019-01-02 12:00 ' ,
158
163
'description ' => 'Symfony Live is really awesome ' ,
159
- 'location ' => ' Dornbirn ' ,
164
+ 'locationId ' => $ location -> getId () ,
160
165
]
161
166
);
162
167
@@ -173,7 +178,7 @@ public function testPut(): void
173
178
$ this ->assertSame ('2019-01-01T12:00:00 ' , $ result ['startDate ' ]);
174
179
$ this ->assertSame ('2019-01-02T12:00:00 ' , $ result ['endDate ' ]);
175
180
$ this ->assertSame ('Symfony Live is really awesome ' , $ result ['description ' ]);
176
- $ this ->assertSame (' Dornbirn ' , $ result ['location ' ]);
181
+ $ this ->assertSame ($ location -> getId () , $ result ['locationId ' ]);
177
182
178
183
$ result = $ this ->findEventById ($ result ['id ' ], 'de ' );
179
184
@@ -186,7 +191,7 @@ public function testPut(): void
186
191
$ this ->assertNotNull ($ result ->getEndDate ());
187
192
$ this ->assertSame ('2019-01-02T12:00:00 ' , $ result ->getEndDate ()->format ('Y-m-d\TH:i:s ' ));
188
193
$ this ->assertSame ('Symfony Live is really awesome ' , $ result ->getDescription ());
189
- $ this ->assertSame (' Dornbirn ' , $ result ->getLocation ());
194
+ $ this ->assertSame ($ location -> getId () , $ result ->getLocationId ());
190
195
}
191
196
192
197
public function testPutNullValues (): void
0 commit comments