same db ?
The same tests were successful in one project and failed in another
Hello friends. I created a custom Laravel package. Feature tests are used in the package. When running the tests on a Laravel project, all were successful and there were no failures or errors. In another project, the exact same package was installed using composer. Both Laravel projects are version 7.30.6 and both packages are the same. In the second project, some tests failed because the expected result and the actual result are slightly different.
in this failure 'tasks count' is integer in the expected result and in actual result is a string
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'{"data":{"task":{"created at":"2022-06-14T08:41:27.000000Z","description":"Asperiores sed aspernatur quod. Pariatur sapiente voluptas ipsam consequatur ratione. Molestias harum quibusdam sint.","id":2,"labels":[{"id":1,"name":"Orlando Hessel Sr.","tasks count":2},{"id":2,"name":"Ms. Lupe Upton","tasks count":1}],"last updated at":"2022-06-14T08:41:27.000000Z","status":"Open","title":"Animi officiis modi qui maiores molestiae quibusdam cumque voluptatum."}}}'
+'{"data":{"task":{"created at":"2022-06-14T08:41:27.000000Z","description":"Asperiores sed aspernatur quod. Pariatur sapiente voluptas ipsam consequatur ratione. Molestias harum quibusdam sint.","id":2,"labels":[{"id":1,"name":"Orlando Hessel Sr.","tasks count":"2"},{"id":2,"name":"Ms. Lupe Upton","tasks count":"1"}],"last updated at":"2022-06-14T08:41:27.000000Z","status":"Open","title":"Animi officiis modi qui maiores molestiae quibusdam cumque voluptatum."}}}'
in another failure 'user_id' has a problem. again integer versus string happened.
Failed asserting that a row in the table [tasks] matches the attributes {
"user_id": 2,
"title": "Ullam explicabo aut quia necessitatibus.",
"description": "Doloremque voluptatem dolorem delectus eligendi provident reiciendis quidem eum. Eum maxime dignissimos et et voluptas mollitia ratione.",
"status": "Open",
"updated_at": "2022-06-14T08:41:27.000000Z",
"created_at": "2022-06-14T08:41:27.000000Z",
"id": 1
}.
Found similar results: [
{
"id": "1",
"user_id": "2",
"title": "Ullam explicabo aut quia necessitatibus.",
"description": "Doloremque voluptatem dolorem delectus eligendi provident reiciendis quidem eum. Eum maxime dignissimos et et voluptas mollitia ratione.", "status": "Open",
"created_at": "2022-06-14 08:41:27",
"updated_at": "2022-06-14 08:41:27"
}
].
composer.json, composer.lock, phpunit.xml and ... are the same in two projects and packages. i used BeyondCompare software for comparing projects.
why in one project failure occurred and in another not happened. What can be the problem? how to solve it? thanks for your help.
Please or to participate in this conversation.