refactor: use english for routes, parameters and internal messages
This commit is contained in:
1 parent
bce8f58be3
commit
a88ff7ff24
22 files changed
+106
-135
No files matched your search
@@ -44,11 +44,11 @@ class BookingControllerTest extends WebTestCase
|
||||
{
|
||||
$this->client->loginUser($this->user('[email protected]'));
|
||||
|
||||
$this->client->request('GET', '/buchen/schreibtische/tag/2026-10-01', server: ['HTTP_HX-Request' => 'true']);
|
||||
$this->client->request('GET', '/book/desk/day/2026-10-01', server: ['HTTP_HX-Request' => 'true']);
|
||||
$response = $this->client->getResponse();
|
||||
|
||||
self::assertResponseIsSuccessful();
|
||||
self::assertSame('/buchen/schreibtische?tag=2026-10-01', $response->headers->get('HX-Push-Url'));
|
||||
self::assertSame('/book/desk?date=2026-10-01', $response->headers->get('HX-Push-Url'));
|
||||
self::assertSame(2, substr_count((string) $response->getContent(), 'hx-swap-oob="true"'));
|
||||
self::assertStringContainsString('id="board-calendar"', (string) $response->getContent());
|
||||
self::assertStringContainsString('id="board-floorplan"', (string) $response->getContent());
|
||||
@@ -58,9 +58,9 @@ class BookingControllerTest extends WebTestCase
|
||||
{
|
||||
$this->client->loginUser($this->user('[email protected]'));
|
||||
|
||||
$this->client->request('GET', '/buchen/schreibtische/tag/2026-10-01');
|
||||
$this->client->request('GET', '/book/desk/day/2026-10-01');
|
||||
|
||||
self::assertResponseRedirects('/buchen/schreibtische?tag=2026-10-01');
|
||||
self::assertResponseRedirects('/book/desk?date=2026-10-01');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -146,7 +146,7 @@ class BookingControllerTest extends WebTestCase
|
||||
$this->client->loginUser($this->user('[email protected]'));
|
||||
$desk = $this->resource('D1');
|
||||
|
||||
$this->client->request('POST', \sprintf('/buchungen/neu/%d/2026-10-01', $desk->getId()), [
|
||||
$this->client->request('POST', \sprintf('/bookings/new/%d/2026-10-01', $desk->getId()), [
|
||||
'booking' => ['date' => '2026-10-01', '_token' => 'nope'],
|
||||
], server: ['HTTP_HX-Request' => 'true']);
|
||||
|
||||
@@ -167,7 +167,7 @@ class BookingControllerTest extends WebTestCase
|
||||
$this->em->flush();
|
||||
|
||||
$this->client->loginUser($this->user('[email protected]'));
|
||||
$this->client->request('POST', \sprintf('/buchungen/%d/freigeben', $booking->getId()), server: ['HTTP_HX-Request' => 'true']);
|
||||
$this->client->request('POST', \sprintf('/bookings/%d/release', $booking->getId()), server: ['HTTP_HX-Request' => 'true']);
|
||||
|
||||
$response = $this->client->getResponse();
|
||||
self::assertSame('body', $response->headers->get('HX-Retarget'));
|
||||
@@ -186,11 +186,11 @@ class BookingControllerTest extends WebTestCase
|
||||
|
||||
// Releasing lives in the edit modal now, not on the floor plan -- clicking your own desk
|
||||
// opens that modal, and the token is rendered there.
|
||||
$crawler = $this->client->request('GET', \sprintf('/buchungen/%d/bearbeiten', $id), server: ['HTTP_HX-Request' => 'true']);
|
||||
$vals = $crawler->filter(\sprintf('[hx-post="/buchungen/%d/freigeben"]', $id))->attr('hx-vals');
|
||||
$crawler = $this->client->request('GET', \sprintf('/bookings/%d/edit', $id), server: ['HTTP_HX-Request' => 'true']);
|
||||
$vals = $crawler->filter(\sprintf('[hx-post="/bookings/%d/release"]', $id))->attr('hx-vals');
|
||||
$token = json_decode((string) $vals, true, flags: \JSON_THROW_ON_ERROR)['_token'];
|
||||
|
||||
$this->client->request('POST', \sprintf('/buchungen/%d/freigeben', $id), ['_token' => $token], server: ['HTTP_HX-Request' => 'true']);
|
||||
$this->client->request('POST', \sprintf('/bookings/%d/release', $id), ['_token' => $token], server: ['HTTP_HX-Request' => 'true']);
|
||||
|
||||
self::assertResponseIsSuccessful();
|
||||
self::assertSame(3, substr_count((string) $this->client->getResponse()->getContent(), 'hx-swap-oob="true"'));
|
||||
@@ -205,9 +205,9 @@ class BookingControllerTest extends WebTestCase
|
||||
$this->em->flush();
|
||||
|
||||
$this->client->loginUser($anna);
|
||||
$crawler = $this->client->request('GET', '/buchen/schreibtische?tag=2026-10-01');
|
||||
$crawler = $this->client->request('GET', '/book/desk?date=2026-10-01');
|
||||
|
||||
self::assertCount(1, $crawler->filter(\sprintf('[hx-get="/buchungen/%d/bearbeiten"]', $booking->getId())));
|
||||
self::assertCount(1, $crawler->filter(\sprintf('[hx-get="/bookings/%d/edit"]', $booking->getId())));
|
||||
}
|
||||
|
||||
public function testBookingPartOfADay(): void
|
||||
@@ -338,7 +338,7 @@ class BookingControllerTest extends WebTestCase
|
||||
|
||||
$crawler = $this->client->request(
|
||||
'GET',
|
||||
\sprintf('/buchungen/neu/%d/2026-10-01?von=09:00&bis=13:00', $desk->getId()),
|
||||
\sprintf('/bookings/new/%d/2026-10-01?from=09:00&to=13:00', $desk->getId()),
|
||||
server: ['HTTP_HX-Request' => 'true'],
|
||||
);
|
||||
|
||||
@@ -351,10 +351,10 @@ class BookingControllerTest extends WebTestCase
|
||||
{
|
||||
$this->client->loginUser($this->user('[email protected]'));
|
||||
|
||||
$this->client->request('GET', '/buchen/schreibtische/tag/2026-10-01?von=09:00&bis=13:00', server: ['HTTP_HX-Request' => 'true']);
|
||||
$this->client->request('GET', '/book/desk/day/2026-10-01?from=09:00&to=13:00', server: ['HTTP_HX-Request' => 'true']);
|
||||
|
||||
self::assertResponseIsSuccessful();
|
||||
self::assertSame('/buchen/schreibtische?tag=2026-10-01&von=09:00&bis=13:00', $this->client->getResponse()->headers->get('HX-Push-Url'));
|
||||
self::assertSame('/book/desk?date=2026-10-01&from=09:00&to=13:00', $this->client->getResponse()->headers->get('HX-Push-Url'));
|
||||
}
|
||||
|
||||
public function testOverridingOneOccurrenceLeavesTheSeriesAlone(): void
|
||||
@@ -375,7 +375,7 @@ class BookingControllerTest extends WebTestCase
|
||||
self::assertCount(4, $occurrences);
|
||||
$first = $occurrences[0];
|
||||
|
||||
$crawler = $this->client->request('GET', \sprintf('/buchungen/%d/bearbeiten', $first->getId()), server: ['HTTP_HX-Request' => 'true']);
|
||||
$crawler = $this->client->request('GET', \sprintf('/bookings/%d/edit', $first->getId()), server: ['HTTP_HX-Request' => 'true']);
|
||||
// Only the span is editable here: the day and the recurrence belong to the series.
|
||||
self::assertCount(0, $crawler->filter('#booking_date'));
|
||||
self::assertCount(0, $crawler->filter('#booking_repeat'));
|
||||
@@ -410,7 +410,7 @@ class BookingControllerTest extends WebTestCase
|
||||
*/
|
||||
private function submitBookingModal(Resource $resource, string $routeDate, array $fields = ['allDay' => '1']): Response
|
||||
{
|
||||
$url = \sprintf('/buchungen/neu/%d/%s', $resource->getId(), $routeDate);
|
||||
$url = \sprintf('/bookings/new/%d/%s', $resource->getId(), $routeDate);
|
||||
$crawler = $this->client->request('GET', $url, server: ['HTTP_HX-Request' => 'true']);
|
||||
self::assertResponseIsSuccessful();
|
||||
|
||||
|
||||
@@ -46,8 +46,8 @@ class DashboardControllerTest extends WebTestCase
|
||||
foreach (ResourceType::cases() as $type) {
|
||||
self::assertCount(
|
||||
1,
|
||||
$crawler->filter(\sprintf('a[href="/buchen/%s"]', $type->slug())),
|
||||
\sprintf('no dashboard tile links to the %s board', $type->slug()),
|
||||
$crawler->filter(\sprintf('a[href="/book/%s"]', $type->value)),
|
||||
\sprintf('no dashboard tile links to the %s board', $type->value),
|
||||
);
|
||||
self::assertStringContainsString($type->plural(), $crawler->html());
|
||||
}
|
||||
@@ -61,7 +61,7 @@ class DashboardControllerTest extends WebTestCase
|
||||
$this->client->loginUser($this->user());
|
||||
$crawler = $this->client->request('GET', '/');
|
||||
|
||||
self::assertCount(1, $crawler->filter('a[href="/buchungen"]'));
|
||||
self::assertCount(1, $crawler->filter('a[href="/bookings"]'));
|
||||
}
|
||||
|
||||
public function testTheNavigationIsGone(): void
|
||||
@@ -86,7 +86,7 @@ class DashboardControllerTest extends WebTestCase
|
||||
$this->client->loginUser($user);
|
||||
$crawler = $this->client->request('GET', '/');
|
||||
|
||||
$tile = $crawler->filter('a[href="/buchen/schreibtische"]')->text();
|
||||
$tile = $crawler->filter('a[href="/book/desk"]')->text();
|
||||
self::assertStringContainsString('von 2 heute frei', $tile);
|
||||
self::assertStringContainsString('1', $tile);
|
||||
}
|
||||
@@ -104,7 +104,7 @@ class DashboardControllerTest extends WebTestCase
|
||||
$this->client->loginUser($this->user());
|
||||
$crawler = $this->client->request('GET', '/');
|
||||
|
||||
self::assertStringContainsString('heute alles belegt', $crawler->filter('a[href="/buchen/schreibtische"]')->text());
|
||||
self::assertStringContainsString('heute alles belegt', $crawler->filter('a[href="/book/desk"]')->text());
|
||||
}
|
||||
|
||||
public function testYourOwnBookingIsCalledOutOnTheTile(): void
|
||||
@@ -116,7 +116,7 @@ class DashboardControllerTest extends WebTestCase
|
||||
$this->client->loginUser($user);
|
||||
$crawler = $this->client->request('GET', '/');
|
||||
|
||||
self::assertStringContainsString('D1', $crawler->filter('a[href="/buchen/schreibtische"]')->text());
|
||||
self::assertStringContainsString('D1', $crawler->filter('a[href="/book/desk"]')->text());
|
||||
}
|
||||
|
||||
public function testABoardOnlyShowsItsOwnKindOfResource(): void
|
||||
@@ -126,11 +126,11 @@ class DashboardControllerTest extends WebTestCase
|
||||
|
||||
$this->client->loginUser($this->user());
|
||||
|
||||
$desks = $this->client->request('GET', '/buchen/schreibtische')->html();
|
||||
$desks = $this->client->request('GET', '/book/desk')->html();
|
||||
self::assertStringContainsString('D1', $desks);
|
||||
self::assertStringNotContainsString('P1', $desks);
|
||||
|
||||
$parking = $this->client->request('GET', '/buchen/parkplaetze')->html();
|
||||
$parking = $this->client->request('GET', '/book/parking')->html();
|
||||
self::assertStringContainsString('P1', $parking);
|
||||
self::assertStringNotContainsString('D1', $parking);
|
||||
}
|
||||
@@ -138,7 +138,7 @@ class DashboardControllerTest extends WebTestCase
|
||||
public function testAnUnknownBookingAreaIsNotFound(): void
|
||||
{
|
||||
$this->client->loginUser($this->user());
|
||||
$this->client->request('GET', '/buchen/fahrraeder');
|
||||
$this->client->request('GET', '/book/bikes');
|
||||
|
||||
self::assertResponseStatusCodeSame(404);
|
||||
}
|
||||
@@ -149,7 +149,7 @@ class DashboardControllerTest extends WebTestCase
|
||||
|
||||
self::assertStringContainsString(
|
||||
'noch nichts eingerichtet',
|
||||
$this->client->request('GET', '/buchen/parkplaetze')->html(),
|
||||
$this->client->request('GET', '/book/parking')->html(),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user