Skip to content

Commit

Permalink
MNT Add method getResponse to mock controller (#304)
Browse files Browse the repository at this point in the history
* MNT Add method getResponse to mock controller

* Fix spelling issue in behat test
  • Loading branch information
sabina-talipova authored Nov 29, 2023
1 parent 076ffa7 commit f86ef06
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tests/behat/features/ckan.feature
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ Feature: Use CKAN
When I click the "Data" CMS tab
When I fill in "DataResource-uri" with "https://catalogue.data.govt.nz/dataset/directory-of-educational-institutions"
And I wait for 5 seconds
And I should see "Early Childhood Services (ECE) Directory"
When I select "New Zealand Schools" from the ".ckan-resource-locator__resource-select select" field
And I should see "Early Childhood Services (ECEs) Directory"
When I select "Schools Directory" from the ".ckan-resource-locator__resource-select select" field
And I wait for 5 seconds
And I press the "Save" button
Then I should see a "Saved" success toast
Expand All @@ -36,10 +36,10 @@ Feature: Use CKAN
And I check "Form_DataColumns_GridFieldEditableColumns_4_ShowInResultsView"
And I press the "Save" button
And I go to "/my-ckan-registry-page?stage=Stage"
Then I should see "School id"
Then I should see "Ece id"
And I should see "Org name"
And I should see "Telephone"
And I should see "Search"
When I click on the ".griddle-table-heading-cell:nth-of-type(2)" element
And I wait for 2 seconds
Then I should see "Albury School"
Then I should see "ABC Educare"
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use SilverStripe\CKANRegistry\Service\ResourcePopulatorInterface;
use SilverStripe\Control\Controller;
use SilverStripe\Control\HTTPRequest;
use SilverStripe\Control\HTTPResponse;
use SilverStripe\Core\Injector\Injector;
use SilverStripe\Dev\SapphireTest;
use SilverStripe\Forms\Form;
Expand Down Expand Up @@ -123,6 +124,7 @@ protected function moveFieldFixture($fixture, $newPosition)
$controllerMock = $this->createMock(Controller::class);
$controllerMock->method('Link')->willReturn('test');
$controllerMock->method('getRequest')->willReturn($request);
$controllerMock->method('getResponse')->willReturn(new HTTPResponse('test'));

// Create an item request
$itemRequest = new ResourceFieldItemRequest(
Expand Down

0 comments on commit f86ef06

Please sign in to comment.