-
-
Notifications
You must be signed in to change notification settings - Fork 964
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
Question: Invalid value provided (invalid IRI?) Error testing POST endpoint #1099
Comments
any idea anyone? |
Try use just application/json as CONTENT_TYPE and HTTP_ACCEPT in your tests in this case. |
@Arkowsky yes I tried already, same result. |
I think you have to setId after you create object and this is the issue. Your identifier is empty and after create is called normalizer to show your results so you need to have id set. |
@Arkowsky as mentioned it works using POSTMAN. The issue must be something different given that it is failing when testing only, and only with POST/PUT calls. |
Same problem here, have you found a solution? |
Take a look on this line $client->request('POST', '/api/products', [], [], $headers, json_encode($postData)); try to don´t make a json_encode() , only pass the $postData like an array.
|
I have the same problem :( |
I have a Product entity (that implements an interface I made - AuthoredUsedEntity), related to another User entity with a relation manyToOne. AuthoredUsedEntity is used to populate the user field in Product with the current logged in User.
when I make an api call to /api/products (I use postman) passing a json like this:
this works and a new record is created with the correct userID. The problem is with unit tests. I make a call like this:
and I get this error: Invalid value provided (invalid IRI?)
am I doing anything wrong? For tests I am using phpunit and Liip.
thanks
M
The text was updated successfully, but these errors were encountered: