add tailiwindi
This commit is contained in:
parent
314063f15c
commit
f38c05d97c
27 changed files with 1139 additions and 494 deletions
|
@ -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],
|
||||
]
|
||||
);
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
16
tests/Unit/ExampleTest.php
Normal file
16
tests/Unit/ExampleTest.php
Normal 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);
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue