Chapters
37 Chapters
|
3:43:31
|
Login to bookmark this video
-
Course Code
Subscribe to download the code!
Subscribe to download the code!
-
This Video
Subscribe to download the video!
Subscribe to download the video!
-
Subtitles
Subscribe to download the subtitles!
Subscribe to download the subtitles!
-
Course Script
Subscribe to download the script!
Subscribe to download the script!
Scroll down to the script below, click on any sentence (including terminal blocks) to jump to that spot in the video!
Subscribe to jump to this part in the video!
Keep on Learning!
If you liked what you've learned so far, dive in! Subscribe to get access to this tutorial plus video, code and script downloads.
What PHP libraries does this tutorial use?
// composer.json
{
"require": {
"php": ">=8.2",
"ext-ctype": "*",
"ext-iconv": "*",
"api-platform/core": "^3.0", // v3.1.2
"doctrine/annotations": "^2.0", // 2.0.1
"doctrine/doctrine-bundle": "^2.8", // 2.8.3
"doctrine/doctrine-migrations-bundle": "^3.2", // 3.2.2
"doctrine/orm": "^2.14", // 2.14.1
"nelmio/cors-bundle": "^2.2", // 2.2.0
"nesbot/carbon": "^2.64", // 2.66.0
"phpdocumentor/reflection-docblock": "^5.3", // 5.3.0
"phpstan/phpdoc-parser": "^1.15", // 1.16.1
"symfony/asset": "6.2.*", // v6.2.5
"symfony/console": "6.2.*", // v6.2.5
"symfony/dotenv": "6.2.*", // v6.2.5
"symfony/expression-language": "6.2.*", // v6.2.5
"symfony/flex": "^2", // v2.2.4
"symfony/framework-bundle": "6.2.*", // v6.2.5
"symfony/property-access": "6.2.*", // v6.2.5
"symfony/property-info": "6.2.*", // v6.2.5
"symfony/runtime": "6.2.*", // v6.2.5
"symfony/security-bundle": "6.2.*", // v6.2.6
"symfony/serializer": "6.2.*", // v6.2.5
"symfony/twig-bundle": "6.2.*", // v6.2.5
"symfony/ux-react": "^2.6", // v2.7.1
"symfony/ux-vue": "^2.7", // v2.7.1
"symfony/validator": "6.2.*", // v6.2.5
"symfony/webpack-encore-bundle": "^1.16", // v1.16.1
"symfony/yaml": "6.2.*" // v6.2.5
},
"require-dev": {
"doctrine/doctrine-fixtures-bundle": "^3.4", // 3.4.2
"mtdowling/jmespath.php": "^2.6", // 2.6.1
"phpunit/phpunit": "^9.5", // 9.6.3
"symfony/browser-kit": "6.2.*", // v6.2.5
"symfony/css-selector": "6.2.*", // v6.2.5
"symfony/debug-bundle": "6.2.*", // v6.2.5
"symfony/maker-bundle": "^1.48", // v1.48.0
"symfony/monolog-bundle": "^3.0", // v3.8.0
"symfony/phpunit-bridge": "^6.2", // v6.2.5
"symfony/stopwatch": "6.2.*", // v6.2.5
"symfony/web-profiler-bundle": "6.2.*", // v6.2.5
"zenstruck/browser": "^1.2", // v1.2.0
"zenstruck/foundry": "^1.26" // v1.28.0
}
}
13 Comments
For those who cannot see any dump after executing tests like me, remember to add into config file debug.yaml
Hey Abraham,
Thanks for this tip!
Cheers!
this statement : '
->assertJsonMatches('"hydra:totalItems"', 5)'generate this error:
My dump json reveal that it has data.
Fixtures launch correctly.
And I also try this : '
->assertJsonMatches('"hydra:totalItems"', '5')'I will investigate this later but if anyone have a explication now he is welcome : )
although the
'5'is type casting your integer to a string... I got the samenullerror when trying to get the value fromhydra:totalItems. so I was looking into the dump and noticed, that currently the property has changed tototalItemsonly. same formemberHey @neostar
Why are you adding additional quotes? IIRC it should be like this
->assertJsonMatches('hydra:totalItems', 5)Cheers!
according to this chapter (see video around 2:20) and the transcript you have to add quotes when dealing with a colon.
see also tests/Functional/DragonTreasureResourceTest.php line 29 or 30 in the "finished" version.
whoops sorry =) my bad
Have you tried
->dump()to check the output?Cheers!
see the comment further up.. it's not about the quotes in the first place. but the fact that the
hydra:prefix is not existing anymore in the newest version.Yes, but I consider that you are all using API Platform bundled with course, which is based on version 3.1, and no one mentions upgrade to the latest version of it.
fair point. at least if somebody is running into the same problem, they will find 2 possible reasons here now.
Agree! Thanks for cooperation!
Have a good day. Happy codding! Cheers!
Hi everyone !
For me, this, it is not working :
I've got this error :
PDOException: SQLSTATE[23000]: Integrity constraint violation: 19 NOT NULL constraint failed: dragon_treasure.owner_idSo, let's do it :
Voilà : It's alive :-)
OK (1 test, 3 assertions)I'm using SQLite, I don't know if it matters.
Hey @DrT
Yes, you need to set the
ownerfield somehow to get rid of that error. In the tutorial we do this inside theDragonTreasureFactory::getDefaults()methodCheers!
"Houston: no signs of life"
Start the conversation!