Skip to content

#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

Closed
wants to merge 19 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions behat.yml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ default:
suites:
default:
contexts:
- 'ApiPlatform\Tests\Behat\Issue5736Context'
- 'ApiPlatform\Tests\Behat\CommandContext'
- 'ApiPlatform\Tests\Behat\DoctrineContext'
- 'ApiPlatform\Tests\Behat\GraphqlContext'
Expand Down
107 changes: 107 additions & 0 deletions features/main/issue5736/company.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
@issue5736 @5736_company
Feature: Resources, subresources and their subresources with uri variables that are not `id`
As a client software developer
I need to be able to update subresources and their deeper subresources

@createSchema
Scenario: GET Companies collection
Given there are 3 companies
And I send a "GET" request to "/issue5736_companies"

Then the response status code should be 200
And the response should be in JSON
And the JSON should be equal to:
"""
{
"@context": "/contexts/Company",
"@id": "/issue5736_companies",
"@type": "hydra:Collection",
"hydra:totalItems": 3,
"hydra:member": [
{
"@id": "/issue5736_companies/1",
"@type": "Company",
"id": 1,
"name": "Company #1"
},
{
"@id": "/issue5736_companies/2",
"@type": "Company",
"id": 2,
"name": "Company #2"
},
{
"@id": "/issue5736_companies/3",
"@type": "Company",
"id": 3,
"name": "Company #3"
}
]
}
"""

@createSchema
Scenario: POST Company
Given I add "Content-Type" header equal to "application/json"
And I send a "POST" request to "/issue5736_companies" with body:
"""
{
"name": "Company 1"
}
"""

Then the response status code should be 201
And the response should be in JSON
And the JSON should be equal to:
"""
{
"@context": "/contexts/Company",
"@id": "/issue5736_companies/1",
"@type": "Company",
"id": 1,
"name": "Company 1"
}
"""

@createSchema
Scenario: GET Company
Given there are 3 companies
Given I add "Content-Type" header equal to "application/json"
And I send a "GET" request to "/issue5736_companies/1"

Then the response status code should be 200
And the response should be in JSON
And the JSON should be equal to:
"""
{
"@context": "/contexts/Company",
"@id": "/issue5736_companies/1",
"@type": "Company",
"id": 1,
"name": "Company #1"
}
"""

@createSchema
Scenario: PUT Company
Given there are 3 companies
Given I add "Content-Type" header equal to "application/json"
And I send a "PUT" request to "/issue5736_companies/1" with body:
"""
{
"name": "Company 1 - edited"
}
"""

Then the response status code should be 200
And the response should be in JSON
And the JSON should be equal to:
"""
{
"@context": "/contexts/Company",
"@id": "/issue5736_companies/1",
"@type": "Company",
"id": 1,
"name": "Company 1 - edited"
}
"""
Loading