add tailiwindi

This commit is contained in:
lubiana 2025-05-24 23:02:31 +02:00
parent 314063f15c
commit f38c05d97c
Signed by: lubiana
SSH key fingerprint: SHA256:vW1EA0fRR3Fw+dD/sM0K+x3Il2gSry6YRYHqOeQwrfk
27 changed files with 1139 additions and 494 deletions

View file

@ -44,7 +44,7 @@ describe(FoodOrderController::class, function (): void {
$crawler = $this->client->request('GET', "{$this->path}list");
$this->assertResponseStatusCodeSame(200);
$this->assertPageTitleContains('FoodOrder index');
$this->assertPageTitleContains('Food Orders');
$this->assertCount(
1,
$crawler->filter('td')
@ -99,17 +99,20 @@ describe(FoodOrderController::class, function (): void {
$crawler = $this->client->request('GET', "{$this->path}{$order->getId()}");
$this->assertResponseIsSuccessful();
$tdContent = $crawler->filter(
'table.table:nth-child(6) > tbody:nth-child(2) > tr:nth-child(1) > td:nth-child(3)'
)->text();
// Find all tables and get the last one (order items table)
$tables = $crawler->filter('table');
$lastTable = $tables->eq($tables->count() - 1);
// Get the item names from the table rows
$rows = $lastTable->filter('tbody tr');
$tdContent = $rows->eq(0)->filter('td')->eq(2)->text();
$this->assertEquals('A', $tdContent);
$tdContent = $crawler->filter(
'table.table:nth-child(6) > tbody:nth-child(2) > tr:nth-child(2) > td:nth-child(3)'
)->text();
$tdContent = $rows->eq(1)->filter('td')->eq(2)->text();
$this->assertEquals('B', $tdContent);
$tdContent = $crawler->filter(
'table.table:nth-child(6) > tbody:nth-child(2) > tr:nth-child(3) > td:nth-child(3)'
)->text();
$tdContent = $rows->eq(2)->filter('td')->eq(2)->text();
$this->assertEquals('C', $tdContent);
});
@ -124,12 +127,12 @@ describe(FoodOrderController::class, function (): void {
$this->manager->flush();
$crawler = $this->client->request('GET', "{$this->path}list");
$this->assertResponseStatusCodeSame(200);
$this->assertPageTitleContains('FoodOrder index');
$this->assertPageTitleContains('Food Orders');
$this->assertElementContainsCount(
$crawler,
'td',
1,
'older orders'
'for older orders'
);
$this->assertElementContainsCount(
$crawler,
@ -139,7 +142,7 @@ describe(FoodOrderController::class, function (): void {
);
});
test('paginatedFirstPage', function (int $page, int $prevPage, int $nextPage, int $items = 10): void {
test('paginatedFirstPage', function (int $page, int $prevPage, int $nextPage, int $items = 20): void {
foreach (range(1, 35) as $i) {
$order = new FoodOrder($this->generateOldUlid());
$order->setFoodVendor($this->vendor);
@ -150,7 +153,7 @@ describe(FoodOrderController::class, function (): void {
$this->manager->flush();
$crawler = $this->client->request('GET', "{$this->path}list/archive/{$page}");
$this->assertResponseStatusCodeSame(200);
$this->assertPageTitleContains('FoodOrder index');
$this->assertPageTitleContains('Food Orders');
$this->assertElementContainsCount(
$crawler,
'td',
@ -160,14 +163,14 @@ describe(FoodOrderController::class, function (): void {
if ($prevPage > 0) {
$prevPage = $prevPage === 1 ? '' : "/{$prevPage}";
$node = $crawler->filter('a')
->reduce(static fn(Crawler $node, $i): bool => $node->text() === 'previous page')
->reduce(static fn(Crawler $node, $i): bool => $node->text() === 'Previous Page')
->first();
$target = $node->attr('href');
$this->assertTrue(str_ends_with((string) $target, $prevPage));
}
if ($prevPage > 3) {
$node = $crawler->filter('a')
->reduce(static fn(Crawler $node, $i): bool => $node->text() === 'next page')
->reduce(static fn(Crawler $node, $i): bool => $node->text() === 'Next Page')
->first();
$target = $node->attr('href');
$this->assertTrue(str_ends_with((string) $target, "/{$nextPage}"));
@ -178,7 +181,7 @@ describe(FoodOrderController::class, function (): void {
[1, 0, 2],
[2, 1, 3],
[3, 2, 4],
[4, 3, 0, 5],
[4, 3, 0, 10],
]
);

View file

@ -29,7 +29,7 @@ describe(FoodVendorController::class, function (): void {
$this->client->request('GET', $this->path);
$this->assertResponseStatusCodeSame(200);
$this->assertPageTitleContains('FoodVendor index');
$this->assertPageTitleContains('Food Vendors');
});
test('new', function (): void {

View file

@ -136,10 +136,9 @@ describe(MenuItemController::class, function (): void {
$this->assertTrue($menuItem->isDeleted());
$crawler = $this->client->request('GET', '/order/item/new/' . $order->getId());
$count = $crawler->filter('body > main:nth-child(2) > div:nth-child(5)')
->children()
$count = $crawler->filter('form')
->count();
$this->assertSame(2, $count);
$this->assertSame(1, $count);
$this->assertResponseIsSuccessful();

View file

@ -60,8 +60,7 @@ describe(OrderItemController::class, function (): void {
sprintf('%snew/%s', $this->path, $this->order->getId())
);
$children = $crawler->filter('body > main:nth-child(2) > div:nth-child(5)')
->children();
$children = $crawler->filter('form');
$this->assertCount(1, $children);

View file

@ -0,0 +1,16 @@
<?php declare(strict_types=1);
test('example test', function (): void {
// This is a simple example test
expect(true)->toBeTrue();
expect(1 + 1)->toBe(2);
expect('hello world')->toContain('world');
});
test('array operations', function (): void {
$array = [1, 2, 3];
expect($array)->toHaveCount(3);
expect($array)->toContain(2);
expect($array[0])->toBe(1);
});