diff --git a/js/src/services/api.service.js b/js/src/services/api.service.js index 282f8e0358..9e1906b119 100644 --- a/js/src/services/api.service.js +++ b/js/src/services/api.service.js @@ -211,7 +211,7 @@ class ApiService { * @param response */ onFailure(response) { - // if json is returned, it should contains the error within message property + // if json is returned, it should contain the error within message property if (Object.prototype.hasOwnProperty.call(response, 'success') && !response.success) { if (Object.prototype.hasOwnProperty.call(response, 'useWindow') && response.useWindow) { atk.apiService.showErrorWindow(response.message); diff --git a/phpstan.neon.dist b/phpstan.neon.dist index a3f9f2158d..8b10e828c1 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -1535,9 +1535,6 @@ parameters: - path: 'src/JsReload.php' message: '~^Method Atk4\\Ui\\JsReload::__construct\(\) has parameter \$view with no type specified\.$~' - - - path: 'src/JsSearch.php' - message: '~^Property Atk4\\Ui\\JsSearch::\$args has no type specified\.$~' - path: 'src/JsSearch.php' message: '~^Property Atk4\\Ui\\JsSearch::\$filterIcon has no type specified\.$~' @@ -1679,18 +1676,6 @@ parameters: - path: 'src/Modal.php' message: '~^Property Atk4\\Ui\\Modal::\$headerCss has no type specified\.$~' - - - path: 'src/Modal.php' - message: '~^Property Atk4\\Ui\\Modal::\$fx has no type specified\.$~' - - - path: 'src/Modal.php' - message: '~^Property Atk4\\Ui\\Modal::\$cb has no type specified\.$~' - - - path: 'src/Modal.php' - message: '~^Property Atk4\\Ui\\Modal::\$cb_view has no type specified\.$~' - - - path: 'src/Modal.php' - message: '~^Property Atk4\\Ui\\Modal::\$args has no type specified\.$~' - path: 'src/Modal.php' message: '~^Method Atk4\\Ui\\Modal::enableCallback\(\) has no return type specified\.$~' diff --git a/src/Behat/Context.php b/src/Behat/Context.php index f4174acef0..670e2151f3 100644 --- a/src/Behat/Context.php +++ b/src/Behat/Context.php @@ -49,7 +49,7 @@ public function closeAllToasts(BeforeStepScope $event): void return; } - if (!str_starts_with($event->getStep()->getText(), 'Toast display should contains text ')) { + if (!str_starts_with($event->getStep()->getText(), 'Toast display should contain text ')) { $this->getSession()->executeScript('jQuery(\'.toast-box > .ui.toast\').toast(\'close\');'); } } @@ -583,7 +583,7 @@ public function iScrollToTop(): void } /** - * @Then Toast display should contains text :arg1 + * @Then Toast display should contain text :arg1 */ public function toastDisplayShouldContainText(string $text): void { @@ -594,9 +594,9 @@ public function toastDisplayShouldContainText(string $text): void } /** - * @Then /^page url should contains \'([^\']*)\'$/ + * @Then /^page url should contain \'([^\']*)\'$/ */ - public function pageUrlShouldContains(string $text): void + public function pageUrlShouldContain(string $text): void { $url = $this->getSession()->getCurrentUrl(); if (!strpos($url, $text)) { @@ -615,9 +615,9 @@ public function compareElementText(string $compareSelector, string $compareToSel } /** - * @Then /^text in container using \'([^\']*)\' should contains \'([^\']*)\'$/ + * @Then /^text in container using \'([^\']*)\' should contain \'([^\']*)\'$/ */ - public function textInContainerUsingShouldContains(string $selector, string $text): void + public function textInContainerUsingShouldContain(string $selector, string $text): void { if (trim($this->getElementInPage($selector)->getText()) !== $text) { throw new Exception('Container with selector: ' . $selector . ' does not contain text: ' . $text); diff --git a/src/JsSearch.php b/src/JsSearch.php index 9191b8c78a..15d4748565 100644 --- a/src/JsSearch.php +++ b/src/JsSearch.php @@ -13,6 +13,7 @@ class JsSearch extends View /** @var View The View to reload using this JsSearch. */ public $reload; + /** @var array */ public $args = []; /** diff --git a/src/Modal.php b/src/Modal.php index 1dd15a9908..86937134b7 100644 --- a/src/Modal.php +++ b/src/Modal.php @@ -36,9 +36,13 @@ class Modal extends View public $loading_label = 'Loading...'; public $headerCss = 'header'; public $ui = 'modal'; - public $fx = []; + /** @var \Closure|null */ + public $fx; + /** @var CallbackLater|null */ public $cb; + /** @var View|null */ public $cb_view; + /** @var array */ public $args = []; /** @var array */ public $options = []; @@ -80,7 +84,7 @@ public function set($fx = null, $ignore = null) throw new Exception('Only one argument is needed by Modal::set()'); } - $this->fx = [$fx]; + $this->fx = $fx; $this->enableCallback(); return $this; @@ -101,7 +105,7 @@ public function enableCallback() } $this->cb->set(function () { - $this->fx[0]($this->cb_view); + ($this->fx)($this->cb_view); $this->cb->terminateJson($this->cb_view); }); } @@ -301,7 +305,7 @@ protected function renderView(): void $this->template->trySet('contentCss', implode(' ', $this->contentCss)); } - if (!empty($this->fx)) { + if ($this->fx !== null) { $data['uri'] = $this->cb->getJsUrl(); } diff --git a/src/Table/Column/ActionButtons.php b/src/Table/Column/ActionButtons.php index dd17d0051a..8b79189aea 100644 --- a/src/Table/Column/ActionButtons.php +++ b/src/Table/Column/ActionButtons.php @@ -10,6 +10,7 @@ use Atk4\Ui\JsChain; use Atk4\Ui\Table; use Atk4\Ui\UserAction\ExecutorInterface; +use Atk4\Ui\View; /** * Formatting action buttons column. @@ -33,10 +34,10 @@ protected function init(): void * * Returns button object * - * @param \Atk4\Ui\View|string $button + * @param View|string $button * @param JsChain|\Closure|ExecutorInterface $action * - * @return \Atk4\Ui\View + * @return View */ public function addButton($button, $action = null, string $confirmMsg = '', $isDisabled = false) { @@ -47,7 +48,7 @@ public function addButton($button, $action = null, string $confirmMsg = '', $isD $button = [1 => $button]; } - $button = Factory::factory([\Atk4\Ui\Button::class], Factory::mergeSeeds($button, ['id' => false])); + $button = Factory::factory([Button::class], Factory::mergeSeeds($button, ['id' => false])); } if ($isDisabled === true) { @@ -71,12 +72,12 @@ public function addButton($button, $action = null, string $confirmMsg = '', $isD * Adds a new button which will open a modal dialog and dynamically * load contents through $callback. Will pass a virtual page. * - * @param \Atk4\Ui\View|string $button - * @param string|array $defaults modal title or modal defaults array - * @param \Atk4\Ui\View $owner - * @param array $args + * @param View|string $button + * @param string|array $defaults modal title or modal defaults array + * @param View $owner + * @param array $args * - * @return \Atk4\Ui\View + * @return View */ public function addModal($button, $defaults, \Closure $callback, $owner = null, $args = []) { @@ -90,7 +91,7 @@ public function addModal($button, $defaults, \Closure $callback, $owner = null, $modal->observeChanges(); // adds scrollbar if needed - $modal->set(function (\Atk4\Ui\Modal $t) use ($callback) { + $modal->set(function (View $t) use ($callback) { $callback($t, $t->stickyGet($this->name)); }); diff --git a/tests-behat/basicexecutor.feature b/tests-behat/basicexecutor.feature index f5ca1d819a..72169a51ed 100644 --- a/tests-behat/basicexecutor.feature +++ b/tests-behat/basicexecutor.feature @@ -4,7 +4,7 @@ Feature: Executor Scenario: basic Given I am on "data-action/actions.php" And I press button "Import" - Then Toast display should contains text "Done!" + Then Toast display should contain text "Done!" Scenario: form Given I am on "data-action/actions.php" @@ -12,9 +12,9 @@ Feature: Executor Then I should see "Must not be empty" Then I fill in "path" with "." Then I press button "Run Import" - Then Toast display should contains text "Imported!" + Then Toast display should contain text "Imported!" Scenario: preview Given I am on "data-action/actions.php" And I press button "Confirm" - Then Toast display should contains text "Confirm!" + Then Toast display should contain text "Confirm!" diff --git a/tests-behat/callback.feature b/tests-behat/callback.feature index 0e32690918..a43ad93f1e 100644 --- a/tests-behat/callback.feature +++ b/tests-behat/callback.feature @@ -6,7 +6,7 @@ Feature: Callback Then I press button "First" Then I should see "TestName" And I press Modal button "Save" - Then Toast display should contains text "Save" + Then Toast display should contain text "Save" Then I should not see "TestName" Scenario: @@ -20,4 +20,4 @@ Feature: Callback Then I click first element using class ".ui.atk-test.button" Then Modal is open with text "Edit Country" Then I press Modal button "Save" - Then Toast display should contains text "Form Submit" + Then Toast display should contain text "Form Submit" diff --git a/tests-behat/card.feature b/tests-behat/card.feature index 9d81dbc7a4..225e58bc82 100644 --- a/tests-behat/card.feature +++ b/tests-behat/card.feature @@ -7,4 +7,4 @@ Feature: Card Then Modal is open with text "Note" in tag "label" When I fill in "note" with "This is a test note" Then I press Modal button "Notify" - Then Toast display should contains text "This is a test note" + Then Toast display should contain text "This is a test note" diff --git a/tests-behat/crud.feature b/tests-behat/crud.feature index c89d6b4f37..2f167d5680 100644 --- a/tests-behat/crud.feature +++ b/tests-behat/crud.feature @@ -13,7 +13,7 @@ Feature: Crud # '50ce262c' = substr(md5('phonecode'), 0, 8) Then I fill in "atk_fp_country__50ce262c" with "1" Then I press Modal button "Save" - Then Toast display should contains text "Form Submit" + Then Toast display should contain text "Form Submit" Scenario: search Then I search grid for "united kingdom" @@ -23,7 +23,7 @@ Feature: Crud Then I press button "Edit" Then Modal is open with text "Edit Country" Then I press Modal button "Save" - Then Toast display should contains text "Form Submit" + Then Toast display should contain text "Form Submit" # make sure search query stick Then I should see "United Kingdom" diff --git a/tests-behat/grid.feature b/tests-behat/grid.feature index 3988fdff39..c53aba0acd 100644 --- a/tests-behat/grid.feature +++ b/tests-behat/grid.feature @@ -6,7 +6,7 @@ Feature: Grid Then I search grid for "kingdom" Then I should see "United Kingdom" Then I press button "Test" - Then Toast display should contains text "United Kingdom" + Then Toast display should contain text "United Kingdom" # click search remove icon Then I click icon using css "i.atk-remove-icon" Then I should not see "United Kingdom" @@ -14,5 +14,5 @@ Feature: Grid Scenario: search no ajax Given I am on "collection/grid.php?no-ajax=1" Then I search grid for "kingdom" - Then page url should contains '_q=kingdom' + Then page url should contain '_q=kingdom' Then I should see "United Kingdom" diff --git a/tests-behat/lookup.feature b/tests-behat/lookup.feature index 1b61dc2486..66ca76e858 100644 --- a/tests-behat/lookup.feature +++ b/tests-behat/lookup.feature @@ -9,14 +9,14 @@ Feature: Lookup # '6f3c91cf' = substr(md5('product_sub_category'), 0, 8) Then I select value "Yogourt" in lookup "atk_fp_product__6f3c91cf_id" Then I press modal button "Save" - Then Toast display should contains text 'Dairy - Yogourt' + Then Toast display should contain text 'Dairy - Yogourt' Scenario: Testing lookup in VirtualPage Given I am on "_unit-test/lookup-virtual-page.php" Then I press menu button "Add Category" using class "atk-grid-menu" Then I select value "Beverages" in lookup "category" Then I press Modal button "Save" - Then Toast display should contains text "Beverages" + Then Toast display should contain text "Beverages" Scenario: Testing lookup add Given I am on "form-control/lookup.php" @@ -28,4 +28,4 @@ Feature: Lookup # '50ce262c' = substr(md5('phonecode'), 0, 8) When I fill in "atk_fp_country__50ce262c" with "8" Then I press Modal button "Save" - Then Toast display should contains text "Form submit!" + Then Toast display should contain text "Form submit!" diff --git a/tests-behat/rightpanel.feature b/tests-behat/rightpanel.feature index 9be6dd6a88..64037c1f8b 100644 --- a/tests-behat/rightpanel.feature +++ b/tests-behat/rightpanel.feature @@ -14,4 +14,4 @@ Feature: RightPanel Then I click first card on page And I press button "User Confirmation" And I press Modal button "Ok" - Then Toast display should contains text "Confirm country" + Then Toast display should contain text "Confirm country" diff --git a/tests-behat/useraction.feature b/tests-behat/useraction.feature index 20a96a13ad..adfb9b5fac 100644 --- a/tests-behat/useraction.feature +++ b/tests-behat/useraction.feature @@ -4,19 +4,19 @@ Feature: UserAction Scenario: Given I am on "data-action/jsactions2.php" And I press button "Callback" - Then Toast display should contains text "callback execute using country" + Then Toast display should contain text "callback execute using country" Scenario: And I press button "Argument" Then Modal is open with text "Age" in tag "label" When I fill Modal field "age" with "22" Then I press Modal button "Argument" - Then Toast display should contains text "22 is old enough to visit" + Then Toast display should contain text "22 is old enough to visit" Scenario: And I press button "User Confirmation" And I press Modal button "Ok" - Then Toast display should contains text "Confirm country" + Then Toast display should contain text "Confirm country" Scenario: And I press button "Multi Step" @@ -26,7 +26,7 @@ Feature: UserAction Then I press Modal button "Next" Then Modal is open with text "Gender = m / Age = 22" Then I press Modal button "Multi Step" - Then Toast display should contains text "Thank you Mr. at age 22" + Then Toast display should contain text "Thank you Mr. at age 22" Scenario: testing VpExecutor Given I am on "data-action/jsactions-vp.php" @@ -56,7 +56,7 @@ Feature: UserAction Then Panel is open with text "Age" in tag "label" When I fill Panel field "age" with "22" Then I press Panel button "Argument" - Then Toast display should contains text "22 is old enough to visit" + Then Toast display should contain text "22 is old enough to visit" Scenario: testing multi in panel And I press button "Multi Step" @@ -66,4 +66,4 @@ Feature: UserAction Then I press Panel button "Next" Then Panel is open with text "Gender = m / Age = 22" Then I press Panel button "Multi Step" - Then Toast display should contains text "Thank you Mr. at age 22" + Then Toast display should contain text "Thank you Mr. at age 22" diff --git a/tests-behat/virtual-page.feature b/tests-behat/virtual-page.feature index 0cf55b19da..0d551e75fb 100644 --- a/tests-behat/virtual-page.feature +++ b/tests-behat/virtual-page.feature @@ -3,7 +3,7 @@ Feature: VirtualPage Scenario: Given I am on "interactive/virtual.php" Then I click link 'More info on Car' - Then text in container using '.__atk-behat-test-car' should contains 'Car' + Then text in container using '.__atk-behat-test-car' should contain 'Car' Then I press button "Open Lorem Ipsum" Then Modal is open with text 'This is yet another modal' @@ -15,16 +15,16 @@ Feature: VirtualPage Scenario: Given I am on "interactive/virtual.php" Then I click link 'Inside current layout' - Then text in container using '.__atk-behat-test-content' should contains 'Contents of your pop-up here' + Then text in container using '.__atk-behat-test-content' should contain 'Contents of your pop-up here' Scenario: Given I am on "_unit-test/virtual-page.php" Then I click link 'Open First' - Then text in container using '.__atk-behat-test-first' should contains 'First Level Page' + Then text in container using '.__atk-behat-test-first' should contain 'First Level Page' Then I click link 'Open Second' - Then text in container using '.__atk-behat-test-second' should contains 'Second Level Page' + Then text in container using '.__atk-behat-test-second' should contain 'Second Level Page' Then I click link 'Open Third' - Then text in container using '.__atk-behat-test-third' should contains 'Third Level Page' + Then text in container using '.__atk-behat-test-third' should contain 'Third Level Page' Then I select value "Beverages" in lookup "category" Then I press button "Save" - Then Toast display should contains text 'Beverages' + Then Toast display should contain text 'Beverages'