add mutation testing
All checks were successful
/ ls (pull_request) Successful in 2m13s
/ ls (push) Successful in 2m11s

This commit is contained in:
lubiana 2024-09-15 22:11:42 +02:00
parent 12ff38ecd6
commit 7674b6a6bd
No known key found for this signature in database
22 changed files with 1239 additions and 247 deletions

View file

@ -118,7 +118,13 @@ final class FoodVendorControllerTest extends DbWebTest
$this->manager->persist($fixture);
$this->manager->flush();
$this->client->request('GET', sprintf('%s%s/edit', $this->path, $fixture->getId()));
$crawler = $this->client->request('GET', sprintf('%s%s/edit', $this->path, $fixture->getId()));
$this->assertSame(
$crawler->filter('#food_vendor_name')
->last()
->attr('value', ''),
'Value'
);
$this->client->submitForm('Update', [
'food_vendor[name]' => 'Something New',

View file

@ -34,6 +34,21 @@ final class HomeControllerTest extends DbWebTest
self::assertResponseStatusCodeSame(302);
self::assertResponseHeaderSame('Location', '/food/order/list');
self::assertResponseCookieValueSame('username', 'Testing-1');
$crawler = $this->client->request(
'GET',
'/username',
);
self::assertResponseStatusCodeSame(200);
$this->assertSame(
$crawler->filter('#user_name_form_username')
->last()
->attr('value', ''),
'Testing-1'
);
}
public function testRemoveUsername(): void

View file

@ -38,6 +38,16 @@ final class OrderItemControllerTest extends DbWebTest
$this->menuItem->setName('Testing');
$this->menuItem->setFoodVendor($this->vendor);
$vendor2 = new FoodVendor;
$vendor2->setName('Vendor 2');
$menuItem2 = new MenuItem;
$menuItem2->setName('Testing2');
$menuItem2->setFoodVendor($vendor2);
$this->manager->persist($vendor2);
$this->manager->persist($menuItem2);
$this->manager->persist($this->menuItem);
$this->manager->flush();
@ -46,11 +56,16 @@ final class OrderItemControllerTest extends DbWebTest
public function testNew(): void
{
$this->client->request(
$crawler = $this->client->request(
'GET',
sprintf('%snew/%s', $this->path, $this->order->getId())
);
$children = $crawler->filter('body > main:nth-child(2) > div:nth-child(5)')
->children();
$this->assertCount(1, $children);
self::assertResponseStatusCodeSame(200);
$this->client->submitForm('Save', [
@ -61,7 +76,9 @@ final class OrderItemControllerTest extends DbWebTest
self::assertResponseRedirects(sprintf('/food/order/%s', $this->order->getId()));
self::assertSame(1, $this->repository->count([]));
self::assertSame(1, $this->menuItemRepository->count([]));
self::assertSame(1, $this->menuItemRepository->count([
'foodVendor' => $this->vendor->getId(),
]));
}
public function testNewOrderClosed(): void
@ -98,7 +115,7 @@ final class OrderItemControllerTest extends DbWebTest
self::assertResponseRedirects(sprintf('/food/order/%s', $this->order->getId()));
self::assertSame(1, $this->repository->count([]));
self::assertSame(2, $this->menuItemRepository->count([]));
self::assertSame(3, $this->menuItemRepository->count([]));
}
public function testRemove(): void
@ -171,7 +188,7 @@ final class OrderItemControllerTest extends DbWebTest
self::assertResponseRedirects(sprintf('/food/order/%s', $this->order->getId()));
self::assertSame(1, $this->repository->count([]));
self::assertSame(2, $this->menuItemRepository->count([]));
self::assertSame(3, $this->menuItemRepository->count([]));
}