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 \Component \HttpFoundation \Response ;
10
11
11
12
class EventControllerTest extends SuluTestCase
12
13
{
13
14
use EventTrait;
15
+ use LocationTrait;
14
16
15
17
public function setUp (): void
16
18
{
@@ -65,6 +67,8 @@ public function testPost(): void
65
67
{
66
68
$ client = $ this ->createAuthenticatedClient ();
67
69
70
+ $ location = $ this ->createLocation ('Sulu HQ ' );
71
+
68
72
$ client ->request (
69
73
'POST ' ,
70
74
'/admin/api/events?locale=de ' ,
@@ -74,7 +78,7 @@ public function testPost(): void
74
78
'startDate ' => '2019-01-01 12:00 ' ,
75
79
'endDate ' => '2019-01-02 12:00 ' ,
76
80
'description ' => 'Sulu is really awesome ' ,
77
- 'location ' => ' Dornbirn ' ,
81
+ 'locationId ' => $ location -> getId () ,
78
82
]
79
83
);
80
84
@@ -91,7 +95,7 @@ public function testPost(): void
91
95
$ this ->assertSame ('2019-01-01T12:00:00 ' , $ result ['startDate ' ]);
92
96
$ this ->assertSame ('2019-01-02T12:00:00 ' , $ result ['endDate ' ]);
93
97
$ this ->assertSame ('Sulu is really awesome ' , $ result ['description ' ]);
94
- $ this ->assertSame (' Dornbirn ' , $ result ['location ' ]);
98
+ $ this ->assertSame ($ location -> getId () , $ result ['locationId ' ]);
95
99
96
100
$ result = $ this ->findEventById ($ result ['id ' ], 'de ' );
97
101
@@ -104,7 +108,7 @@ public function testPost(): void
104
108
$ this ->assertNotNull ($ result ->getEndDate ());
105
109
$ this ->assertSame ('2019-01-02T12:00:00 ' , $ result ->getEndDate ()->format ('Y-m-d\TH:i:s ' ));
106
110
$ this ->assertSame ('Sulu is really awesome ' , $ result ->getDescription ());
107
- $ this ->assertSame (' Dornbirn ' , $ result ->getLocation ());
111
+ $ this ->assertSame ($ location -> getId () , $ result ->getLocationId ());
108
112
}
109
113
110
114
public function testPostNullValues (): void
@@ -151,6 +155,7 @@ public function testPut(): void
151
155
$ client = $ this ->createAuthenticatedClient ();
152
156
153
157
$ event = $ this ->createEvent ('Symfony ' , 'de ' );
158
+ $ location = $ this ->createLocation ('Sulu HQ ' );
154
159
155
160
$ client ->request (
156
161
'PUT ' ,
@@ -161,7 +166,7 @@ public function testPut(): void
161
166
'startDate ' => '2019-01-01 12:00 ' ,
162
167
'endDate ' => '2019-01-02 12:00 ' ,
163
168
'description ' => 'Symfony Live is really awesome ' ,
164
- 'location ' => ' Dornbirn ' ,
169
+ 'locationId ' => $ location -> getId () ,
165
170
]
166
171
);
167
172
@@ -178,7 +183,7 @@ public function testPut(): void
178
183
$ this ->assertSame ('2019-01-01T12:00:00 ' , $ result ['startDate ' ]);
179
184
$ this ->assertSame ('2019-01-02T12:00:00 ' , $ result ['endDate ' ]);
180
185
$ this ->assertSame ('Symfony Live is really awesome ' , $ result ['description ' ]);
181
- $ this ->assertSame (' Dornbirn ' , $ result ['location ' ]);
186
+ $ this ->assertSame ($ location -> getId () , $ result ['locationId ' ]);
182
187
183
188
$ result = $ this ->findEventById ($ result ['id ' ], 'de ' );
184
189
@@ -191,7 +196,7 @@ public function testPut(): void
191
196
$ this ->assertNotNull ($ result ->getEndDate ());
192
197
$ this ->assertSame ('2019-01-02T12:00:00 ' , $ result ->getEndDate ()->format ('Y-m-d\TH:i:s ' ));
193
198
$ this ->assertSame ('Symfony Live is really awesome ' , $ result ->getDescription ());
194
- $ this ->assertSame (' Dornbirn ' , $ result ->getLocation ());
199
+ $ this ->assertSame ($ location -> getId () , $ result ->getLocationId ());
195
200
}
196
201
197
202
public function testPutNullValues (): void
0 commit comments