-
-
Notifications
You must be signed in to change notification settings - Fork 921
#5736 Create a failing scenario. #5747
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
53ce8f2
to
ab4404a
Compare
I've spend quite some time and couldn't actually try this as the test case is incomplete |
@soyuka , I refined a bit the tests and fixed the tag... EDITED The first test, simply creating the I'm going to fix the other tests... |
8e3a754
to
6ca0aa4
Compare
7fb3cd2
to
39eea31
Compare
@soyuka , I've fixed a lot of issues with the test:
Unfortunately, the tests still don't work. It is strange I cannot create a Then the response status code should be 201 # Behat\MinkExtension\Context\MinkContext::assertResponseStatus()
Current response status code is 400, but 201 expected.
+--[ HTTP/1.1 400 | http://example.com/issue5736_companies/1/issue5736_teams | SymfonyDriver ]
|
| {"@context":"\/contexts\/Error","@type":"hydra:Error","hydra:title":"An error occurred","hydra:description":"Unable to generate an IRI for the item of type \u0022ApiPlatform\\Tests\\Fixtures\\TestBundle\\Entity\\Issue5736Aerendir\\Team\u0022","trace":[{"namespace":"","short_class":"","class":"","type":"","function":"","file":"\/Users\/Aerendir\/Documents\/JooServer\/Lab\/_Forks\/api-platform\/core\/src\/Symfony\/Routing\/IriConverter.php","line":181,"args":[]},{"namespace":"ApiPlatform\\Symfony\\Routing","short_class":"IriConverter","class":"ApiPlatform\\Symfony\\Routing\\IriConverter","type":"-\u003E","function":"generateSymfonyRoute","file":"\/Users\/Aerendir\/Documents\/JooServer\/Lab\/_Forks\/api-platform\/core\/src\/Symfony\/Routing\/IriConverter.php","line":158,"args":[["object","ApiPlatform\\Tests\\Fixtures\\TestBundle\\Entity\\Issue5736Aerendir\\Team"],["integer",1],["object","ApiPlatform\\Metadata\\Get"],["array",[]],["object","ApiPlatform\\Metadata\\Get"]]},{"namespace":"A...
| This should work and should not be related to the Any idea about the cause of the error? I've tried to debug, but, as I don't know well the inners of ApiPlatform, I don't know if what I see is what is expected. I've tested on both To run the failing scenario (# 2): XDEBUG_MODE=debug XDEBUG_SESSION=1 vendor/bin/behat --name "POST Company then POST Team" -vvv Without fixing this, I cannot go forward to fix other tests :( |
there was a |
@soyuka , yes: I've just discovered the issue... But the error is hidden in other errors: I think that the message should be clearer: a thing that requires just 3 seconds to fix (adding a I really not know why I use I was to ask you (forgiving me for the stupid question), which is the difference, but it seems here there is the answer: #2066 UPDATE And I have just tested the scenarios on |
@soyuka , finally I discovered the issue and identified it, isolated it and completed the reproducing scenarios! 🎉 I've just tested this PR on both versions:
Which is the problemThe problem is only with When using Identified the file in which the problem happens, lets discuss about its causes. The problem is the way the variable core/src/Serializer/ItemNormalizer.php Lines 88 to 106 in 16b8111
Basically, new API\Link(fromClass: Team::class, toProperty: 'team', identifiers: ['id']) Now, what basically happens is that This But this same property More, each placeholder defined via the But the values should be different. In fact, I used always the first inserted entity (so But, if we start to use In fact, the script uses But this property exists also on the So, what basically the method does, is get every time the same ID = 1 (the one of the Doing this, it breaks the creation of the IRIs. And this is the cause of the issue. Now, in version WDYT? PS This also tells me that is possible that using I'm going to try to use |
@Aerendir yeah we're working on it with @romainallanot we came to the same conclusions and try to work on a fix |
@soyuka , I tried using |
@soyuka , can I close this PR? |
yes thanks @Aerendir for trying to find what was wrong I hope you'll get a nice API Platform experience from now on :) |
Failing test scenario for #5736.
cc @soyuka