From aa26c912ce5c27a80a1a06b2a88109cb138083d7 Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Tue, 23 May 2023 11:33:59 +1200 Subject: [PATCH] BUG Correct method parameters on stepCreateRecordWithTable Co-authored-by: Steve Boyd --- .github/workflows/ci.yml | 2 ++ README.md | 2 +- src/Context/FixtureContext.php | 7 ++++--- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bf02210..f5d2f1e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 diff --git a/README.md b/README.md index 1db16b8..b443da0 100644 --- a/README.md +++ b/README.md @@ -235,7 +235,7 @@ use the inline definition syntax. The following example shows some syntax variat 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 + Then I should see "Page 1" * Fixtures are created where you defined them. If you want the fixtures to be created before every scenario, define them in diff --git a/src/Context/FixtureContext.php b/src/Context/FixtureContext.php index 198da84..c5dba7c 100644 --- a/src/Context/FixtureContext.php +++ b/src/Context/FixtureContext.php @@ -289,22 +289,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); } }