#29_improve-tests #36

Merged
lubiana merged 2 commits from #29_improve-tests into main 2024-07-10 20:20:21 +00:00
8 changed files with 395 additions and 177 deletions

View file

@ -11,6 +11,7 @@
"doctrine/doctrine-bundle": "^2.12", "doctrine/doctrine-bundle": "^2.12",
"doctrine/doctrine-migrations-bundle": "^3.3", "doctrine/doctrine-migrations-bundle": "^3.3",
"doctrine/orm": "^3.2", "doctrine/orm": "^3.2",
"psr/clock": "^1.0",
"symfony/console": "7.1.*", "symfony/console": "7.1.*",
"symfony/dotenv": "7.1.*", "symfony/dotenv": "7.1.*",
"symfony/flex": "^2", "symfony/flex": "^2",
@ -25,7 +26,7 @@
}, },
"require-dev": { "require-dev": {
"lubiana/code-quality": "^1.7", "lubiana/code-quality": "^1.7",
"phpunit/phpunit": "^9.5", "phpunit/phpunit": "^9.6.19",
"symfony/browser-kit": "7.1.*", "symfony/browser-kit": "7.1.*",
"symfony/css-selector": "7.1.*", "symfony/css-selector": "7.1.*",
"symfony/maker-bundle": "^1.60", "symfony/maker-bundle": "^1.60",

352
composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "ab475528135d157af8dae9e8b967be1a", "content-hash": "2196ad236d40a68b165bf39ce4543bfc",
"packages": [ "packages": [
{ {
"name": "doctrine/cache", "name": "doctrine/cache",
@ -883,21 +883,21 @@
}, },
{ {
"name": "doctrine/migrations", "name": "doctrine/migrations",
"version": "3.7.4", "version": "3.8.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/doctrine/migrations.git", "url": "https://github.com/doctrine/migrations.git",
"reference": "954e0a314c2f0eb9fb418210445111747de254a6" "reference": "535a70dcbd88b8c6ba945be050977457f4f4c06c"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/doctrine/migrations/zipball/954e0a314c2f0eb9fb418210445111747de254a6", "url": "https://api.github.com/repos/doctrine/migrations/zipball/535a70dcbd88b8c6ba945be050977457f4f4c06c",
"reference": "954e0a314c2f0eb9fb418210445111747de254a6", "reference": "535a70dcbd88b8c6ba945be050977457f4f4c06c",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"composer-runtime-api": "^2", "composer-runtime-api": "^2",
"doctrine/dbal": "^3.5.1 || ^4", "doctrine/dbal": "^3.6 || ^4",
"doctrine/deprecations": "^0.5.3 || ^1", "doctrine/deprecations": "^0.5.3 || ^1",
"doctrine/event-manager": "^1.2 || ^2.0", "doctrine/event-manager": "^1.2 || ^2.0",
"php": "^8.1", "php": "^8.1",
@ -935,7 +935,7 @@
"type": "library", "type": "library",
"autoload": { "autoload": {
"psr-4": { "psr-4": {
"Doctrine\\Migrations\\": "lib/Doctrine/Migrations" "Doctrine\\Migrations\\": "src"
} }
}, },
"notification-url": "https://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
@ -965,7 +965,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/doctrine/migrations/issues", "issues": "https://github.com/doctrine/migrations/issues",
"source": "https://github.com/doctrine/migrations/tree/3.7.4" "source": "https://github.com/doctrine/migrations/tree/3.8.0"
}, },
"funding": [ "funding": [
{ {
@ -981,20 +981,20 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2024-03-06T13:41:11+00:00" "time": "2024-06-26T14:12:46+00:00"
}, },
{ {
"name": "doctrine/orm", "name": "doctrine/orm",
"version": "3.2.0", "version": "3.2.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/doctrine/orm.git", "url": "https://github.com/doctrine/orm.git",
"reference": "37946d3a21ddf837c0d84f8156ee60a92102e332" "reference": "722cea6536775206e81744542b36fa7c9a4ea3e5"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/doctrine/orm/zipball/37946d3a21ddf837c0d84f8156ee60a92102e332", "url": "https://api.github.com/repos/doctrine/orm/zipball/722cea6536775206e81744542b36fa7c9a4ea3e5",
"reference": "37946d3a21ddf837c0d84f8156ee60a92102e332", "reference": "722cea6536775206e81744542b36fa7c9a4ea3e5",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1067,9 +1067,9 @@
], ],
"support": { "support": {
"issues": "https://github.com/doctrine/orm/issues", "issues": "https://github.com/doctrine/orm/issues",
"source": "https://github.com/doctrine/orm/tree/3.2.0" "source": "https://github.com/doctrine/orm/tree/3.2.1"
}, },
"time": "2024-05-23T14:27:52+00:00" "time": "2024-06-26T21:48:58+00:00"
}, },
{ {
"name": "doctrine/persistence", "name": "doctrine/persistence",
@ -1272,6 +1272,54 @@
}, },
"time": "2021-02-03T23:26:27+00:00" "time": "2021-02-03T23:26:27+00:00"
}, },
{
"name": "psr/clock",
"version": "1.0.0",
"source": {
"type": "git",
"url": "https://github.com/php-fig/clock.git",
"reference": "e41a24703d4560fd0acb709162f73b8adfc3aa0d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/clock/zipball/e41a24703d4560fd0acb709162f73b8adfc3aa0d",
"reference": "e41a24703d4560fd0acb709162f73b8adfc3aa0d",
"shasum": ""
},
"require": {
"php": "^7.0 || ^8.0"
},
"type": "library",
"autoload": {
"psr-4": {
"Psr\\Clock\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "https://www.php-fig.org/"
}
],
"description": "Common interface for reading the clock.",
"homepage": "https://github.com/php-fig/clock",
"keywords": [
"clock",
"now",
"psr",
"psr-20",
"time"
],
"support": {
"issues": "https://github.com/php-fig/clock/issues",
"source": "https://github.com/php-fig/clock/tree/1.0.0"
},
"time": "2022-11-25T14:36:26+00:00"
},
{ {
"name": "psr/container", "name": "psr/container",
"version": "2.0.2", "version": "2.0.2",
@ -1427,16 +1475,16 @@
}, },
{ {
"name": "symfony/cache", "name": "symfony/cache",
"version": "v7.1.1", "version": "v7.1.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/cache.git", "url": "https://github.com/symfony/cache.git",
"reference": "760294dc7158372699dccd077965c16c328f8719" "reference": "e933e1d947ffb88efcdd34a2bd51561cab7deaae"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/cache/zipball/760294dc7158372699dccd077965c16c328f8719", "url": "https://api.github.com/repos/symfony/cache/zipball/e933e1d947ffb88efcdd34a2bd51561cab7deaae",
"reference": "760294dc7158372699dccd077965c16c328f8719", "reference": "e933e1d947ffb88efcdd34a2bd51561cab7deaae",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1504,7 +1552,7 @@
"psr6" "psr6"
], ],
"support": { "support": {
"source": "https://github.com/symfony/cache/tree/v7.1.1" "source": "https://github.com/symfony/cache/tree/v7.1.2"
}, },
"funding": [ "funding": [
{ {
@ -1520,7 +1568,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2024-05-31T14:57:53+00:00" "time": "2024-06-11T13:32:38+00:00"
}, },
{ {
"name": "symfony/cache-contracts", "name": "symfony/cache-contracts",
@ -1675,16 +1723,16 @@
}, },
{ {
"name": "symfony/console", "name": "symfony/console",
"version": "v7.1.1", "version": "v7.1.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/console.git", "url": "https://github.com/symfony/console.git",
"reference": "9b008f2d7b21c74ef4d0c3de6077a642bc55ece3" "reference": "0aa29ca177f432ab68533432db0de059f39c92ae"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/console/zipball/9b008f2d7b21c74ef4d0c3de6077a642bc55ece3", "url": "https://api.github.com/repos/symfony/console/zipball/0aa29ca177f432ab68533432db0de059f39c92ae",
"reference": "9b008f2d7b21c74ef4d0c3de6077a642bc55ece3", "reference": "0aa29ca177f432ab68533432db0de059f39c92ae",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1748,7 +1796,7 @@
"terminal" "terminal"
], ],
"support": { "support": {
"source": "https://github.com/symfony/console/tree/v7.1.1" "source": "https://github.com/symfony/console/tree/v7.1.2"
}, },
"funding": [ "funding": [
{ {
@ -1764,20 +1812,20 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2024-05-31T14:57:53+00:00" "time": "2024-06-28T10:03:55+00:00"
}, },
{ {
"name": "symfony/dependency-injection", "name": "symfony/dependency-injection",
"version": "v7.1.1", "version": "v7.1.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/dependency-injection.git", "url": "https://github.com/symfony/dependency-injection.git",
"reference": "77c636dfd86c0b60c5d184b2fd2ddf8dd11c309c" "reference": "6e108cded928bdafaf1da3fabe30dd5af20e36b9"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/dependency-injection/zipball/77c636dfd86c0b60c5d184b2fd2ddf8dd11c309c", "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/6e108cded928bdafaf1da3fabe30dd5af20e36b9",
"reference": "77c636dfd86c0b60c5d184b2fd2ddf8dd11c309c", "reference": "6e108cded928bdafaf1da3fabe30dd5af20e36b9",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1828,7 +1876,7 @@
"description": "Allows you to standardize and centralize the way objects are constructed in your application", "description": "Allows you to standardize and centralize the way objects are constructed in your application",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"support": { "support": {
"source": "https://github.com/symfony/dependency-injection/tree/v7.1.1" "source": "https://github.com/symfony/dependency-injection/tree/v7.1.2"
}, },
"funding": [ "funding": [
{ {
@ -1844,7 +1892,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2024-05-31T14:57:53+00:00" "time": "2024-06-28T10:03:55+00:00"
}, },
{ {
"name": "symfony/deprecation-contracts", "name": "symfony/deprecation-contracts",
@ -1915,16 +1963,16 @@
}, },
{ {
"name": "symfony/doctrine-bridge", "name": "symfony/doctrine-bridge",
"version": "v7.1.1", "version": "v7.1.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/doctrine-bridge.git", "url": "https://github.com/symfony/doctrine-bridge.git",
"reference": "2c36eca96f111ada35b648a4d6e8aa61f354e4d4" "reference": "9fc4bebf69f00d4ebb12ee904d808b496035e2f6"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/doctrine-bridge/zipball/2c36eca96f111ada35b648a4d6e8aa61f354e4d4", "url": "https://api.github.com/repos/symfony/doctrine-bridge/zipball/9fc4bebf69f00d4ebb12ee904d808b496035e2f6",
"reference": "2c36eca96f111ada35b648a4d6e8aa61f354e4d4", "reference": "9fc4bebf69f00d4ebb12ee904d808b496035e2f6",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2003,7 +2051,7 @@
"description": "Provides integration for Doctrine with various Symfony components", "description": "Provides integration for Doctrine with various Symfony components",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"support": { "support": {
"source": "https://github.com/symfony/doctrine-bridge/tree/v7.1.1" "source": "https://github.com/symfony/doctrine-bridge/tree/v7.1.2"
}, },
"funding": [ "funding": [
{ {
@ -2019,7 +2067,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2024-05-31T14:57:53+00:00" "time": "2024-06-28T09:27:18+00:00"
}, },
{ {
"name": "symfony/dotenv", "name": "symfony/dotenv",
@ -2097,16 +2145,16 @@
}, },
{ {
"name": "symfony/error-handler", "name": "symfony/error-handler",
"version": "v7.1.1", "version": "v7.1.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/error-handler.git", "url": "https://github.com/symfony/error-handler.git",
"reference": "e9b8bbce0b4f322939332ab7b6b81d8c11da27dd" "reference": "2412d3dddb5c9ea51a39cfbff1c565fc9844ca32"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/error-handler/zipball/e9b8bbce0b4f322939332ab7b6b81d8c11da27dd", "url": "https://api.github.com/repos/symfony/error-handler/zipball/2412d3dddb5c9ea51a39cfbff1c565fc9844ca32",
"reference": "e9b8bbce0b4f322939332ab7b6b81d8c11da27dd", "reference": "2412d3dddb5c9ea51a39cfbff1c565fc9844ca32",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2152,7 +2200,7 @@
"description": "Provides tools to manage errors and ease debugging PHP code", "description": "Provides tools to manage errors and ease debugging PHP code",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"support": { "support": {
"source": "https://github.com/symfony/error-handler/tree/v7.1.1" "source": "https://github.com/symfony/error-handler/tree/v7.1.2"
}, },
"funding": [ "funding": [
{ {
@ -2168,7 +2216,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2024-05-31T14:57:53+00:00" "time": "2024-06-25T19:55:06+00:00"
}, },
{ {
"name": "symfony/event-dispatcher", "name": "symfony/event-dispatcher",
@ -2328,16 +2376,16 @@
}, },
{ {
"name": "symfony/filesystem", "name": "symfony/filesystem",
"version": "v7.1.1", "version": "v7.1.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/filesystem.git", "url": "https://github.com/symfony/filesystem.git",
"reference": "802e87002f919296c9f606457d9fa327a0b3d6b2" "reference": "92a91985250c251de9b947a14bb2c9390b1a562c"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/filesystem/zipball/802e87002f919296c9f606457d9fa327a0b3d6b2", "url": "https://api.github.com/repos/symfony/filesystem/zipball/92a91985250c251de9b947a14bb2c9390b1a562c",
"reference": "802e87002f919296c9f606457d9fa327a0b3d6b2", "reference": "92a91985250c251de9b947a14bb2c9390b1a562c",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2374,7 +2422,7 @@
"description": "Provides basic utilities for the filesystem", "description": "Provides basic utilities for the filesystem",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"support": { "support": {
"source": "https://github.com/symfony/filesystem/tree/v7.1.1" "source": "https://github.com/symfony/filesystem/tree/v7.1.2"
}, },
"funding": [ "funding": [
{ {
@ -2390,7 +2438,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2024-05-31T14:57:53+00:00" "time": "2024-06-28T10:03:55+00:00"
}, },
{ {
"name": "symfony/finder", "name": "symfony/finder",
@ -2620,16 +2668,16 @@
}, },
{ {
"name": "symfony/framework-bundle", "name": "symfony/framework-bundle",
"version": "v7.1.1", "version": "v7.1.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/framework-bundle.git", "url": "https://github.com/symfony/framework-bundle.git",
"reference": "79a20497022b8853416e20c836ee150b754c332a" "reference": "54a84f49658e2e87167396b2259a55e55e11f4a2"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/framework-bundle/zipball/79a20497022b8853416e20c836ee150b754c332a", "url": "https://api.github.com/repos/symfony/framework-bundle/zipball/54a84f49658e2e87167396b2259a55e55e11f4a2",
"reference": "79a20497022b8853416e20c836ee150b754c332a", "reference": "54a84f49658e2e87167396b2259a55e55e11f4a2",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2747,7 +2795,7 @@
"description": "Provides a tight integration between Symfony components and the Symfony full-stack framework", "description": "Provides a tight integration between Symfony components and the Symfony full-stack framework",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"support": { "support": {
"source": "https://github.com/symfony/framework-bundle/tree/v7.1.1" "source": "https://github.com/symfony/framework-bundle/tree/v7.1.2"
}, },
"funding": [ "funding": [
{ {
@ -2763,7 +2811,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2024-06-04T06:40:14+00:00" "time": "2024-06-28T08:00:31+00:00"
}, },
{ {
"name": "symfony/http-foundation", "name": "symfony/http-foundation",
@ -2844,16 +2892,16 @@
}, },
{ {
"name": "symfony/http-kernel", "name": "symfony/http-kernel",
"version": "v7.1.1", "version": "v7.1.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/http-kernel.git", "url": "https://github.com/symfony/http-kernel.git",
"reference": "fa8d1c75b5f33b1302afccf81811f93976c6e26f" "reference": "ae3fa717db4d41a55d14c2bd92399e37cf5bc0f6"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/http-kernel/zipball/fa8d1c75b5f33b1302afccf81811f93976c6e26f", "url": "https://api.github.com/repos/symfony/http-kernel/zipball/ae3fa717db4d41a55d14c2bd92399e37cf5bc0f6",
"reference": "fa8d1c75b5f33b1302afccf81811f93976c6e26f", "reference": "ae3fa717db4d41a55d14c2bd92399e37cf5bc0f6",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2938,7 +2986,7 @@
"description": "Provides a structured process for converting a Request into a Response", "description": "Provides a structured process for converting a Request into a Response",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"support": { "support": {
"source": "https://github.com/symfony/http-kernel/tree/v7.1.1" "source": "https://github.com/symfony/http-kernel/tree/v7.1.2"
}, },
"funding": [ "funding": [
{ {
@ -2954,7 +3002,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2024-06-04T06:52:15+00:00" "time": "2024-06-28T13:13:31+00:00"
}, },
{ {
"name": "symfony/options-resolver", "name": "symfony/options-resolver",
@ -3651,16 +3699,16 @@
}, },
{ {
"name": "symfony/property-info", "name": "symfony/property-info",
"version": "v7.1.1", "version": "v7.1.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/property-info.git", "url": "https://github.com/symfony/property-info.git",
"reference": "0f80f818c6728f15de30a4f89866d68e4912ae84" "reference": "d7b91e4aa07e822a9b935fc29a7254c12d502f16"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/property-info/zipball/0f80f818c6728f15de30a4f89866d68e4912ae84", "url": "https://api.github.com/repos/symfony/property-info/zipball/d7b91e4aa07e822a9b935fc29a7254c12d502f16",
"reference": "0f80f818c6728f15de30a4f89866d68e4912ae84", "reference": "d7b91e4aa07e822a9b935fc29a7254c12d502f16",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -3715,7 +3763,7 @@
"validator" "validator"
], ],
"support": { "support": {
"source": "https://github.com/symfony/property-info/tree/v7.1.1" "source": "https://github.com/symfony/property-info/tree/v7.1.2"
}, },
"funding": [ "funding": [
{ {
@ -3731,7 +3779,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2024-05-31T14:57:53+00:00" "time": "2024-06-26T07:21:35+00:00"
}, },
{ {
"name": "symfony/routing", "name": "symfony/routing",
@ -3895,16 +3943,16 @@
}, },
{ {
"name": "symfony/security-core", "name": "symfony/security-core",
"version": "v7.1.1", "version": "v7.1.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/security-core.git", "url": "https://github.com/symfony/security-core.git",
"reference": "536399671a46b0e615d69583f067e30ad25ad038" "reference": "d615960211a11913e70f8576e5c38cd05d90ec3f"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/security-core/zipball/536399671a46b0e615d69583f067e30ad25ad038", "url": "https://api.github.com/repos/symfony/security-core/zipball/d615960211a11913e70f8576e5c38cd05d90ec3f",
"reference": "536399671a46b0e615d69583f067e30ad25ad038", "reference": "d615960211a11913e70f8576e5c38cd05d90ec3f",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -3961,7 +4009,7 @@
"description": "Symfony Security Component - Core Library", "description": "Symfony Security Component - Core Library",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"support": { "support": {
"source": "https://github.com/symfony/security-core/tree/v7.1.1" "source": "https://github.com/symfony/security-core/tree/v7.1.2"
}, },
"funding": [ "funding": [
{ {
@ -3977,7 +4025,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2024-05-31T14:57:53+00:00" "time": "2024-06-28T08:00:31+00:00"
}, },
{ {
"name": "symfony/security-csrf", "name": "symfony/security-csrf",
@ -4194,16 +4242,16 @@
}, },
{ {
"name": "symfony/string", "name": "symfony/string",
"version": "v7.1.1", "version": "v7.1.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/string.git", "url": "https://github.com/symfony/string.git",
"reference": "60bc311c74e0af215101235aa6f471bcbc032df2" "reference": "14221089ac66cf82e3cf3d1c1da65de305587ff8"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/string/zipball/60bc311c74e0af215101235aa6f471bcbc032df2", "url": "https://api.github.com/repos/symfony/string/zipball/14221089ac66cf82e3cf3d1c1da65de305587ff8",
"reference": "60bc311c74e0af215101235aa6f471bcbc032df2", "reference": "14221089ac66cf82e3cf3d1c1da65de305587ff8",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -4261,7 +4309,7 @@
"utf8" "utf8"
], ],
"support": { "support": {
"source": "https://github.com/symfony/string/tree/v7.1.1" "source": "https://github.com/symfony/string/tree/v7.1.2"
}, },
"funding": [ "funding": [
{ {
@ -4277,7 +4325,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2024-06-04T06:40:14+00:00" "time": "2024-06-28T09:27:18+00:00"
}, },
{ {
"name": "symfony/translation-contracts", "name": "symfony/translation-contracts",
@ -4708,16 +4756,16 @@
}, },
{ {
"name": "symfony/validator", "name": "symfony/validator",
"version": "v7.1.1", "version": "v7.1.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/validator.git", "url": "https://github.com/symfony/validator.git",
"reference": "fcab7598968b21c361becc930fcae8846638c4c0" "reference": "bed12b7d5bd4dac452db5fa6203331c876b489e7"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/validator/zipball/fcab7598968b21c361becc930fcae8846638c4c0", "url": "https://api.github.com/repos/symfony/validator/zipball/bed12b7d5bd4dac452db5fa6203331c876b489e7",
"reference": "fcab7598968b21c361becc930fcae8846638c4c0", "reference": "bed12b7d5bd4dac452db5fa6203331c876b489e7",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -4785,7 +4833,7 @@
"description": "Provides tools to validate values", "description": "Provides tools to validate values",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"support": { "support": {
"source": "https://github.com/symfony/validator/tree/v7.1.1" "source": "https://github.com/symfony/validator/tree/v7.1.2"
}, },
"funding": [ "funding": [
{ {
@ -4801,20 +4849,20 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2024-06-04T05:58:56+00:00" "time": "2024-06-25T19:55:06+00:00"
}, },
{ {
"name": "symfony/var-dumper", "name": "symfony/var-dumper",
"version": "v7.1.1", "version": "v7.1.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/var-dumper.git", "url": "https://github.com/symfony/var-dumper.git",
"reference": "deb2c2b506ff6fdbb340e00b34e9901e1605f293" "reference": "5857c57c6b4b86524c08cf4f4bc95327270a816d"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/deb2c2b506ff6fdbb340e00b34e9901e1605f293", "url": "https://api.github.com/repos/symfony/var-dumper/zipball/5857c57c6b4b86524c08cf4f4bc95327270a816d",
"reference": "deb2c2b506ff6fdbb340e00b34e9901e1605f293", "reference": "5857c57c6b4b86524c08cf4f4bc95327270a816d",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -4868,7 +4916,7 @@
"dump" "dump"
], ],
"support": { "support": {
"source": "https://github.com/symfony/var-dumper/tree/v7.1.1" "source": "https://github.com/symfony/var-dumper/tree/v7.1.2"
}, },
"funding": [ "funding": [
{ {
@ -4884,20 +4932,20 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2024-05-31T14:57:53+00:00" "time": "2024-06-28T08:00:31+00:00"
}, },
{ {
"name": "symfony/var-exporter", "name": "symfony/var-exporter",
"version": "v7.1.1", "version": "v7.1.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/var-exporter.git", "url": "https://github.com/symfony/var-exporter.git",
"reference": "db82c2b73b88734557cfc30e3270d83fa651b712" "reference": "b80a669a2264609f07f1667f891dbfca25eba44c"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/var-exporter/zipball/db82c2b73b88734557cfc30e3270d83fa651b712", "url": "https://api.github.com/repos/symfony/var-exporter/zipball/b80a669a2264609f07f1667f891dbfca25eba44c",
"reference": "db82c2b73b88734557cfc30e3270d83fa651b712", "reference": "b80a669a2264609f07f1667f891dbfca25eba44c",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -4944,7 +4992,7 @@
"serialize" "serialize"
], ],
"support": { "support": {
"source": "https://github.com/symfony/var-exporter/tree/v7.1.1" "source": "https://github.com/symfony/var-exporter/tree/v7.1.2"
}, },
"funding": [ "funding": [
{ {
@ -4960,7 +5008,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2024-05-31T14:57:53+00:00" "time": "2024-06-28T08:00:31+00:00"
}, },
{ {
"name": "symfony/yaml", "name": "symfony/yaml",
@ -5350,16 +5398,16 @@
}, },
{ {
"name": "nikic/php-parser", "name": "nikic/php-parser",
"version": "v5.0.2", "version": "v5.1.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/nikic/PHP-Parser.git", "url": "https://github.com/nikic/PHP-Parser.git",
"reference": "139676794dc1e9231bf7bcd123cfc0c99182cb13" "reference": "683130c2ff8c2739f4822ff7ac5c873ec529abd1"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/139676794dc1e9231bf7bcd123cfc0c99182cb13", "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/683130c2ff8c2739f4822ff7ac5c873ec529abd1",
"reference": "139676794dc1e9231bf7bcd123cfc0c99182cb13", "reference": "683130c2ff8c2739f4822ff7ac5c873ec529abd1",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -5370,7 +5418,7 @@
}, },
"require-dev": { "require-dev": {
"ircmaxell/php-yacc": "^0.0.7", "ircmaxell/php-yacc": "^0.0.7",
"phpunit/phpunit": "^7.0 || ^8.0 || ^9.0" "phpunit/phpunit": "^9.0"
}, },
"bin": [ "bin": [
"bin/php-parse" "bin/php-parse"
@ -5402,9 +5450,9 @@
], ],
"support": { "support": {
"issues": "https://github.com/nikic/PHP-Parser/issues", "issues": "https://github.com/nikic/PHP-Parser/issues",
"source": "https://github.com/nikic/PHP-Parser/tree/v5.0.2" "source": "https://github.com/nikic/PHP-Parser/tree/v5.1.0"
}, },
"time": "2024-03-05T20:51:40+00:00" "time": "2024-07-01T20:03:41+00:00"
}, },
{ {
"name": "phar-io/manifest", "name": "phar-io/manifest",
@ -5573,16 +5621,16 @@
}, },
{ {
"name": "phpstan/phpstan", "name": "phpstan/phpstan",
"version": "1.11.5", "version": "1.11.7",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/phpstan/phpstan.git", "url": "https://github.com/phpstan/phpstan.git",
"reference": "490f0ae1c92b082f154681d7849aee776a7c1443" "reference": "52d2bbfdcae7f895915629e4694e9497d0f8e28d"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/490f0ae1c92b082f154681d7849aee776a7c1443", "url": "https://api.github.com/repos/phpstan/phpstan/zipball/52d2bbfdcae7f895915629e4694e9497d0f8e28d",
"reference": "490f0ae1c92b082f154681d7849aee776a7c1443", "reference": "52d2bbfdcae7f895915629e4694e9497d0f8e28d",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -5627,7 +5675,7 @@
"type": "github" "type": "github"
} }
], ],
"time": "2024-06-17T15:10:54+00:00" "time": "2024-07-06T11:17:41+00:00"
}, },
{ {
"name": "phpunit/php-code-coverage", "name": "phpunit/php-code-coverage",
@ -5950,45 +5998,45 @@
}, },
{ {
"name": "phpunit/phpunit", "name": "phpunit/phpunit",
"version": "9.6.19", "version": "9.6.20",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git", "url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "a1a54a473501ef4cdeaae4e06891674114d79db8" "reference": "49d7820565836236411f5dc002d16dd689cde42f"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/a1a54a473501ef4cdeaae4e06891674114d79db8", "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/49d7820565836236411f5dc002d16dd689cde42f",
"reference": "a1a54a473501ef4cdeaae4e06891674114d79db8", "reference": "49d7820565836236411f5dc002d16dd689cde42f",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"doctrine/instantiator": "^1.3.1 || ^2", "doctrine/instantiator": "^1.5.0 || ^2",
"ext-dom": "*", "ext-dom": "*",
"ext-json": "*", "ext-json": "*",
"ext-libxml": "*", "ext-libxml": "*",
"ext-mbstring": "*", "ext-mbstring": "*",
"ext-xml": "*", "ext-xml": "*",
"ext-xmlwriter": "*", "ext-xmlwriter": "*",
"myclabs/deep-copy": "^1.10.1", "myclabs/deep-copy": "^1.12.0",
"phar-io/manifest": "^2.0.3", "phar-io/manifest": "^2.0.4",
"phar-io/version": "^3.0.2", "phar-io/version": "^3.2.1",
"php": ">=7.3", "php": ">=7.3",
"phpunit/php-code-coverage": "^9.2.28", "phpunit/php-code-coverage": "^9.2.31",
"phpunit/php-file-iterator": "^3.0.5", "phpunit/php-file-iterator": "^3.0.6",
"phpunit/php-invoker": "^3.1.1", "phpunit/php-invoker": "^3.1.1",
"phpunit/php-text-template": "^2.0.3", "phpunit/php-text-template": "^2.0.4",
"phpunit/php-timer": "^5.0.2", "phpunit/php-timer": "^5.0.3",
"sebastian/cli-parser": "^1.0.1", "sebastian/cli-parser": "^1.0.2",
"sebastian/code-unit": "^1.0.6", "sebastian/code-unit": "^1.0.8",
"sebastian/comparator": "^4.0.8", "sebastian/comparator": "^4.0.8",
"sebastian/diff": "^4.0.3", "sebastian/diff": "^4.0.6",
"sebastian/environment": "^5.1.3", "sebastian/environment": "^5.1.5",
"sebastian/exporter": "^4.0.5", "sebastian/exporter": "^4.0.6",
"sebastian/global-state": "^5.0.1", "sebastian/global-state": "^5.0.7",
"sebastian/object-enumerator": "^4.0.3", "sebastian/object-enumerator": "^4.0.4",
"sebastian/resource-operations": "^3.0.3", "sebastian/resource-operations": "^3.0.4",
"sebastian/type": "^3.2", "sebastian/type": "^3.2.1",
"sebastian/version": "^3.0.2" "sebastian/version": "^3.0.2"
}, },
"suggest": { "suggest": {
@ -6033,7 +6081,7 @@
"support": { "support": {
"issues": "https://github.com/sebastianbergmann/phpunit/issues", "issues": "https://github.com/sebastianbergmann/phpunit/issues",
"security": "https://github.com/sebastianbergmann/phpunit/security/policy", "security": "https://github.com/sebastianbergmann/phpunit/security/policy",
"source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.19" "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.20"
}, },
"funding": [ "funding": [
{ {
@ -6049,20 +6097,20 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2024-04-05T04:35:58+00:00" "time": "2024-07-10T11:45:39+00:00"
}, },
{ {
"name": "rector/rector", "name": "rector/rector",
"version": "1.1.1", "version": "1.2.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/rectorphp/rector.git", "url": "https://github.com/rectorphp/rector.git",
"reference": "c930cdb21294f10955ddfc31b720971e8333943d" "reference": "2fa387553db22b6f9bcccf5ff16f2c2c18a52a65"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/rectorphp/rector/zipball/c930cdb21294f10955ddfc31b720971e8333943d", "url": "https://api.github.com/repos/rectorphp/rector/zipball/2fa387553db22b6f9bcccf5ff16f2c2c18a52a65",
"reference": "c930cdb21294f10955ddfc31b720971e8333943d", "reference": "2fa387553db22b6f9bcccf5ff16f2c2c18a52a65",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -6100,7 +6148,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/rectorphp/rector/issues", "issues": "https://github.com/rectorphp/rector/issues",
"source": "https://github.com/rectorphp/rector/tree/1.1.1" "source": "https://github.com/rectorphp/rector/tree/1.2.0"
}, },
"funding": [ "funding": [
{ {
@ -6108,7 +6156,7 @@
"type": "github" "type": "github"
} }
], ],
"time": "2024-06-21T07:51:17+00:00" "time": "2024-07-01T14:24:45+00:00"
}, },
{ {
"name": "sebastian/cli-parser", "name": "sebastian/cli-parser",
@ -7512,16 +7560,16 @@
}, },
{ {
"name": "symfony/phpunit-bridge", "name": "symfony/phpunit-bridge",
"version": "v7.1.1", "version": "v7.1.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/phpunit-bridge.git", "url": "https://github.com/symfony/phpunit-bridge.git",
"reference": "3e1cb8c4dee341cfe96ae9fe29b1acda52a6bb16" "reference": "8eb63f1c0e2001f97b3cd9ed550b18765cdeb1c8"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/phpunit-bridge/zipball/3e1cb8c4dee341cfe96ae9fe29b1acda52a6bb16", "url": "https://api.github.com/repos/symfony/phpunit-bridge/zipball/8eb63f1c0e2001f97b3cd9ed550b18765cdeb1c8",
"reference": "3e1cb8c4dee341cfe96ae9fe29b1acda52a6bb16", "reference": "8eb63f1c0e2001f97b3cd9ed550b18765cdeb1c8",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -7574,7 +7622,7 @@
"description": "Provides utilities for PHPUnit, especially user deprecation notices management", "description": "Provides utilities for PHPUnit, especially user deprecation notices management",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"support": { "support": {
"source": "https://github.com/symfony/phpunit-bridge/tree/v7.1.1" "source": "https://github.com/symfony/phpunit-bridge/tree/v7.1.2"
}, },
"funding": [ "funding": [
{ {
@ -7590,7 +7638,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2024-06-04T06:50:37+00:00" "time": "2024-06-25T19:55:06+00:00"
}, },
{ {
"name": "symfony/process", "name": "symfony/process",
@ -7697,16 +7745,16 @@
}, },
{ {
"name": "symplify/easy-coding-standard", "name": "symplify/easy-coding-standard",
"version": "12.3.0", "version": "12.3.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/easy-coding-standard/easy-coding-standard.git", "url": "https://github.com/easy-coding-standard/easy-coding-standard.git",
"reference": "f919574aa566b4d00fd06700ca61168aafef66e1" "reference": "bd670feae8d0b6da891d29a3c549bd0f4aa48711"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/easy-coding-standard/easy-coding-standard/zipball/f919574aa566b4d00fd06700ca61168aafef66e1", "url": "https://api.github.com/repos/easy-coding-standard/easy-coding-standard/zipball/bd670feae8d0b6da891d29a3c549bd0f4aa48711",
"reference": "f919574aa566b4d00fd06700ca61168aafef66e1", "reference": "bd670feae8d0b6da891d29a3c549bd0f4aa48711",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -7742,7 +7790,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/easy-coding-standard/easy-coding-standard/issues", "issues": "https://github.com/easy-coding-standard/easy-coding-standard/issues",
"source": "https://github.com/easy-coding-standard/easy-coding-standard/tree/12.3.0" "source": "https://github.com/easy-coding-standard/easy-coding-standard/tree/12.3.1"
}, },
"funding": [ "funding": [
{ {
@ -7754,7 +7802,7 @@
"type": "github" "type": "github"
} }
], ],
"time": "2024-06-18T07:35:59+00:00" "time": "2024-07-06T12:33:15+00:00"
}, },
{ {
"name": "theseer/tokenizer", "name": "theseer/tokenizer",

View file

@ -15,28 +15,45 @@ use Symfony\Component\Routing\Attribute\Route;
final class FoodOrderController extends AbstractController final class FoodOrderController extends AbstractController
{ {
#[Route( #[Route(
path: '/list/{page}', path: '/list',
name: 'app_food_order_index', name: 'app_food_order_index',
methods: ['GET']
)]
public function index(FoodOrderRepository $foodOrderRepository): Response
{
return $this->render('food_order/index.html.twig', [
'food_orders' => $foodOrderRepository->findLatestEntries(days: 3),
'current_page' => 0,
'next_page' => 0,
'prev_page' => 0,
]);
}
#[Route(
path: '/list/archive/{page}',
name: 'app_food_order_archive',
requirements: [ requirements: [
'page' => '\d+', 'page' => '\d+',
], ],
methods: ['GET'] methods: ['GET']
)] )]
public function index(FoodOrderRepository $foodOrderRepository, int $page = 1): Response public function archive(FoodOrderRepository $foodOrderRepository, int $page = 1): Response
{ {
$days = 4;
if ($page > 1) {
$days = 0;
}
$nextPage = $page + 1; $nextPage = $page + 1;
$prevPage = $page - 1; $prevPage = $page - 1;
$itemsPerPage = 10; $itemsPerPage = 10;
if($foodOrderRepository->count() < $page * $itemsPerPage) { $count = $foodOrderRepository->count();
if($count < $page * $itemsPerPage) {
$nextPage = $page; $nextPage = $page;
} }
return $this->render('food_order/index.html.twig', [ return $this->render('food_order/index.html.twig', [
'food_orders' => $foodOrderRepository->findLatestEntries(page: $page, pagesize: $itemsPerPage, days: $days), 'food_orders' => $foodOrderRepository->findLatestEntries(
page: $page,
pagesize: $itemsPerPage,
days: 0
),
'current_page' => $page, 'current_page' => $page,
'next_page' => $nextPage, 'next_page' => $nextPage,
'prev_page' => $prevPage, 'prev_page' => $prevPage,

View file

@ -8,19 +8,12 @@ use DateTimeImmutable;
use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection; use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\IdGenerator\UlidGenerator;
use Symfony\Bridge\Doctrine\Types\UlidType; use Symfony\Bridge\Doctrine\Types\UlidType;
use Symfony\Component\Uid\Ulid; use Symfony\Component\Uid\Ulid;
#[ORM\Entity(repositoryClass: FoodOrderRepository::class)] #[ORM\Entity(repositoryClass: FoodOrderRepository::class)]
class FoodOrder class FoodOrder
{ {
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'CUSTOM')]
#[ORM\Column(type: UlidType::NAME, unique: true)]
#[ORM\CustomIdGenerator(class: UlidGenerator::class)]
private Ulid|null $id = null;
#[ORM\Column(nullable: true)] #[ORM\Column(nullable: true)]
private DateTimeImmutable|null $closedAt = null; private DateTimeImmutable|null $closedAt = null;
@ -39,8 +32,11 @@ class FoodOrder
])] ])]
private string|null $createdBy = 'nobody'; private string|null $createdBy = 'nobody';
public function __construct() public function __construct(
{ #[ORM\Id]
#[ORM\Column(type: UlidType::NAME, unique: true)]
private Ulid|null $id = new Ulid
) {
$this->orderItems = new ArrayCollection; $this->orderItems = new ArrayCollection;
$this->open(); $this->open();
} }

View file

@ -25,17 +25,21 @@
<tbody> <tbody>
{% for food_order in food_orders %} {% for food_order in food_orders %}
{{ include('food_order/table_row.html.twig') }} {{ include('food_order/table_row.html.twig') }}
{% else %}
<tr>
<td colspan="4">no records found</td>
</tr>
{% endfor %} {% endfor %}
{% if food_orders|length < 10 %}
<tr>
<td colspan="5">
check the <a href="{{ path('app_food_order_archive') }}">archive</a>
for older orders
</td>
</tr>
{% endif %}
</tbody> </tbody>
</table> </table>
{% if prev_page > 0 %} {% if prev_page > 0 %}
<a href="{{ path('app_food_order_index', {'page': prev_page}) }}">previous page</a> | <a href="{{ path('app_food_order_archive', {'page': prev_page}) }}">previous page</a> |
{% endif %} {% endif %}
{% if next_page > current_page %} {% if next_page > current_page %}
<a href="{{ path('app_food_order_index', {'page': next_page}) }}">next page</a> <a href="{{ path('app_food_order_archive', {'page': next_page}) }}">next page</a>
{% endif %} {% endif %}
{% endblock %} {% endblock %}

View file

@ -8,6 +8,7 @@ use App\Tests\DbWebTest;
use Override; use Override;
use Symfony\Component\DomCrawler\Crawler; use Symfony\Component\DomCrawler\Crawler;
use function range;
use function sprintf; use function sprintf;
final class FoodOrderControllerTest extends DbWebTest final class FoodOrderControllerTest extends DbWebTest
@ -51,6 +52,58 @@ final class FoodOrderControllerTest extends DbWebTest
); );
} }
public function testPaginatedIndex(): void
{
$this->generatePaginatedOrders();
$crawler = $this->client->request('GET', "{$this->path}list");
self::assertResponseStatusCodeSame(200);
self::assertPageTitleContains('FoodOrder index');
$this->assertElementContainsCount(
$crawler,
'td',
1,
'older orders'
);
$this->assertElementContainsCount(
$crawler,
'td',
0,
'next page'
);
}
/**
* @testWith [1, 0, 1]
* [2, 1, 1]
* [3, 1, 1]
* [4, 1, 0, 5]
*/
public function testPaginatedFirstPage(int $page, int $prevPage, int $nextPage, int $items = 10): void
{
$this->generatePaginatedOrders();
$crawler = $this->client->request('GET', "{$this->path}list/archive/{$page}");
self::assertResponseStatusCodeSame(200);
self::assertPageTitleContains('FoodOrder index');
$this->assertElementContainsCount(
$crawler,
'td',
$items,
'nobody'
);
$this->assertElementContainsCount(
$crawler,
'a',
$nextPage,
'next page'
);
$this->assertElementContainsCount(
$crawler,
'a',
$prevPage,
'previous page'
);
}
public function testNew(): void public function testNew(): void
{ {
$this->client->request('GET', sprintf('%snew', $this->path)); $this->client->request('GET', sprintf('%snew', $this->path));
@ -64,4 +117,16 @@ final class FoodOrderControllerTest extends DbWebTest
self::assertResponseRedirects("{$this->path}list"); self::assertResponseRedirects("{$this->path}list");
self::assertSame(1, $this->repository->count([])); self::assertSame(1, $this->repository->count([]));
} }
private function generatePaginatedOrders(): void
{
foreach (range(1, 35) as $i) {
$order = new FoodOrder($this->generateOldUlid());
$order->setFoodVendor($this->vendor);
$order->close();
$this->manager->persist($order);
}
$this->manager->flush();
}
} }

View file

@ -0,0 +1,61 @@
<?php declare(strict_types=1);
namespace App\Tests\Controller;
use App\Tests\DbWebTest;
use Override;
final class HomeControllerTest extends DbWebTest
{
public function testIndex(): void
{
$this->client->request(
'GET',
'/'
);
self::assertResponseStatusCodeSame(302);
self::assertResponseHeaderSame('Location', '/food/order/list');
}
public function testSetUsername(): void
{
$this->client->request(
'GET',
'/username',
);
self::assertResponseStatusCodeSame(200);
$this->client->submitForm('Save', [
'user_name_form[username]' => 'Testing-1',
]);
self::assertResponseStatusCodeSame(302);
self::assertResponseHeaderSame('Location', '/food/order/list');
self::assertResponseCookieValueSame('username', 'Testing-1');
}
public function testRemoveUsername(): void
{
$this->client->request(
'GET',
'/username',
);
self::assertResponseStatusCodeSame(200);
$this->client->submitForm('Save', [
'user_name_form[username]' => '',
]);
self::assertResponseStatusCodeSame(302);
self::assertResponseHeaderSame('Location', '/food/order/list');
self::assertResponseCookieValueSame('username', '');
}
#[Override]
public function getEntityClass(): string
{
return '';
}
}

View file

@ -2,12 +2,18 @@
namespace App\Tests; namespace App\Tests;
use DateInterval;
use DateTimeImmutable;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository; use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\Tools\SchemaTool; use Doctrine\ORM\Tools\SchemaTool;
use Override; use Override;
use Symfony\Bundle\FrameworkBundle\KernelBrowser; use Symfony\Bundle\FrameworkBundle\KernelBrowser;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Symfony\Component\DomCrawler\Crawler;
use Symfony\Component\Uid\Ulid;
use function str_contains;
abstract class DbWebTest extends WebTestCase abstract class DbWebTest extends WebTestCase
{ {
@ -28,6 +34,26 @@ abstract class DbWebTest extends WebTestCase
$schemaTool->dropDatabase(); $schemaTool->dropDatabase();
$schemaTool->updateSchema($metadata); $schemaTool->updateSchema($metadata);
if ($this->getEntityClass() !== '') {
$this->repository = $this->manager->getRepository($this->getEntityClass()); $this->repository = $this->manager->getRepository($this->getEntityClass());
} }
}
protected function generateOldUlid(int $daysToSubtract = 10): Ulid
{
$date = (new DateTimeImmutable)->sub(new DateInterval('P' . $daysToSubtract . 'D'));
$ulidString = Ulid::generate($date);
return Ulid::fromString($ulidString);
}
protected function assertElementContainsCount(Crawler $crawler, string $element, int $count, string $text): void
{
$this->assertCount(
$count,
$crawler->filter($element)
->reduce(
static fn(Crawler $node, $i): bool => str_contains($node->text(), $text),
)
);
}
} }