Merge branch '5.0' into 5

This commit is contained in:
Steve Boyd 2023-05-31 15:20:52 +12:00
commit c35e9a440d
3 changed files with 11 additions and 8 deletions

View File

@ -9,3 +9,5 @@ jobs:
ci:
name: CI
uses: silverstripe/gha-ci/.github/workflows/ci.yml@v1
with:
composer_require_extra: silverstripe/installer:4.13.x-dev

View File

@ -240,11 +240,11 @@ Feature: Do something with pages
And a "page" "My Redirect" which redirects to a "page" "Page 1"
And a "member" "Website User" with "FavouritePage"="=>Page.Page 1"
@javascript
Scenario: View a page in the tree
Given I am logged in with "ADMIN" permissions
And I go to "/admin/pages"
Then I should see "Page 1" in CMS Tree
@javascript
Scenario: View a page in the tree
Given I am logged in with "ADMIN" permissions
And I go to "/admin/pages"
Then I should see "Page 1"
```
* Fixtures are created where you defined them. If you want the fixtures to be created

View File

@ -294,22 +294,23 @@ class FixtureContext implements Context
* @param string $null
* @param TableNode $fieldsTable
*/
public function stepCreateRecordWithTable($type, $id, $null, TableNode $fieldsTable)
public function stepCreateRecordWithTable($type, $id, TableNode $fieldsTable)
{
$class = $this->convertTypeToClass($type);
// TODO Support more than one record
$fields = $this->convertFields($class, $fieldsTable->getRowsHash());
$fields = $this->prepareFixture($class, $id, $fields);
// We should check if this fixture object already exists - if it does, we update it. If not, we create it
if ($existingFixture = $this->fixtureFactory->get($class, $id)) {
if ($existingFixture = $this->getFixtureFactory()->get($class, $id)) {
// Merge existing data with new data, and create new object to replace existing object
foreach ($fields as $k => $v) {
$existingFixture->$k = $v;
}
$existingFixture->write();
} else {
$this->fixtureFactory->createObject($class, $id, $fields);
$this->getFixtureFactory()->createObject($class, $id, $fields);
}
}