From a5144fe76a2c770d294ca79378eb0b9d5a3e1044 Mon Sep 17 00:00:00 2001 From: Luca Tumedei Date: Sat, 14 Oct 2023 10:53:02 +0200 Subject: [PATCH 1/4] feat(WPDb) add see|dontSee|grab|dontHave (site)transient methods, fixes #664 --- docs/modules/WPDb.md | 53 ++++ src/Module/WPDb.php | 113 +++++++++ .../_generated/AcceptanceTesterActions.php | 210 ++++++++++++++- .../_generated/ClimoduleTesterActions.php | 239 +++++++++++++++++- .../_generated/FunctionalTesterActions.php | 214 +++++++++++++++- .../_generated/WebDriverTesterActions.php | 210 ++++++++++++++- .../_generated/Wpcli_moduleTesterActions.php | 214 +++++++++++++++- .../_generated/WploaderTesterActions.php | 2 +- .../Wploader_multisiteTesterActions.php | 2 +- ...Wploader_wpdb_interactionTesterActions.php | 216 +++++++++++++++- tests/acceptance/TransientOperationsCest.php | 94 +++++++ 11 files changed, 1550 insertions(+), 17 deletions(-) create mode 100644 tests/acceptance/TransientOperationsCest.php diff --git a/docs/modules/WPDb.md b/docs/modules/WPDb.md index dc18ee98a..f913df658 100644 --- a/docs/modules/WPDb.md +++ b/docs/modules/WPDb.md @@ -565,6 +565,16 @@ $I->dontSeeSiteOptionInDatabase('foo_count', 23); $I->dontSeeSiteOptionInDatabase(['option_name => 'foo_count', 'option_value' => 23]); ``` +#### dontSeeSiteTransientInDatabase +Signature: `dontSeeSiteTransientInDatabase(string $transient, [mixed $value])` : `void` + +Checks that a site transient is not in the database. + +```php +dontSeeSiteTransientInDatabase('foo'); +$I->dontSeeSiteTransientInDatabase('foo', 23); +``` #### dontSeeTableInDatabase Signature: `dontSeeTableInDatabase(string $table)` : `void` @@ -615,6 +625,16 @@ list($termId, $termTaxonomyId) = $I->haveTermInDatabase('fiction', 'genre'); $I->dontSeeTermTaxonomyInDatabase(['term_id' => $termId, 'taxonomy' => 'country']); ``` +#### dontSeeTransientInDatabase +Signature: `dontSeeTransientInDatabase(string $transient, [mixed $value])` : `void` + +Checks that a transient is not in the database. + +```php +dontSeeTransientInDatabase('foo'); +$I->dontSeeTransientInDatabase('foo', 23); +``` #### dontSeeUserInDatabase Signature: `dontSeeUserInDatabase(array $criteria)` : `void` @@ -1200,6 +1220,17 @@ $I->useBlog(23); $I->grabTermsTableName(); ``` +#### grabTransientFromDatabase +Signature: `grabTransientFromDatabase(string $transient)` : `mixed` + +Fetches the value of a transient from the database. + +```php +haveTransientInDatabase('foo', 23); +$transientValue = $I->grabTransientFromDatabase('foo'); +$I->assertEquals(23, $transientValue); +``` #### grabUserIdFromDatabase Signature: `grabUserIdFromDatabase(string $userLogin)` : `int|false` @@ -1932,6 +1963,17 @@ $I->seeSiteSiteTransientInDatabase('total_counts'); $I->seeSiteSiteTransientInDatabase('total_counts', 23); ``` +#### seeSiteTransientInDatabase +Signature: `seeSiteTransientInDatabase(string $transient, [mixed $value])` : `void` + +Checks that a site transient is in the database. + +```php +haveSiteTransientInDatabase('foo', 23); +$I->seeSiteTransientInDatabase('foo'); +$I->seeSiteTransientInDatabase('foo', 23); +``` #### seeTableInDatabase Signature: `seeTableInDatabase(string $table)` : `void` @@ -1989,6 +2031,17 @@ list($termId, $termTaxonomyId) = $I->haveTermInDatabase('fiction', 'genre'); $I->seeTermTaxonomyInDatabase(['term_id' => $termId, 'taxonomy' => 'genre']); ``` +#### seeTransientInDatabase +Signature: `seeTransientInDatabase(string $name, [mixed $value])` : `void` + +Checks that a transient is in the database. + +```php +haveTransientInDatabase('foo', 23); +$I->seeTransientInDatabase('foo'); +$I->seeTransientInDatabase('foo', 23); +``` #### seeUserInDatabase Signature: `seeUserInDatabase(array $criteria)` : `void` diff --git a/src/Module/WPDb.php b/src/Module/WPDb.php index f6f1aa81c..327c21a2b 100644 --- a/src/Module/WPDb.php +++ b/src/Module/WPDb.php @@ -4792,4 +4792,117 @@ protected function normalizeOptionCriteria(array|string $criteriaOrName, mixed $ return $criteria; } + + /** + * Fetches the value of a transient from the database. + * + * @example + * ```php + * $I->haveTransientInDatabase('foo', 23); + * $transientValue = $I->grabTransientFromDatabase('foo'); + * $I->assertEquals(23, $transientValue); + * ``` + * @param string $transient The transient name. + * + * @return mixed The transient value; it will be unserialized if it was serialized. + * + */ + public function grabTransientFromDatabase(string $transient): mixed + { + $transient = $this->normalizePrefixedOptionName($transient, '_transient_'); + return $this->grabOptionFromDatabase($transient); + } + + /** + * Checks that a transient is not in the database. + * + * @example + * ```php + * $I->dontSeeTransientInDatabase('foo'); + * $I->dontSeeTransientInDatabase('foo', 23); + * ``` + * @param mixed $value The optional value to try and match. + * + * @param string $transient The transient name. + * @return void + * @throws JsonException + * + */ + public function dontSeeTransientInDatabase(string $transient, mixed $value = null): void + { + $transient = $this->normalizePrefixedOptionName($transient, '_transient_'); + $this->dontSeeOptionInDatabase($transient, $value); + } + + /** + * Checks that a transient is in the database. + * + * @example + * ```php + * $I->haveTransientInDatabase('foo', 23); + * $I->seeTransientInDatabase('foo'); + * $I->seeTransientInDatabase('foo', 23); + * ``` + * @param mixed $value The optional value to try and match. + * + * @param string $name The transient name. + * @return void + * @throws JsonException + * + */ + public function seeTransientInDatabase(string $name, mixed $value = null): void + { + $transient = $this->normalizePrefixedOptionName($name, '_transient_'); + $this->seeOptionInDatabase($transient, $value); + } + + /** + * Checks that a site transient is not in the database. + * + * @example + * ```php + * $I->dontSeeSiteTransientInDatabase('foo'); + * $I->dontSeeSiteTransientInDatabase('foo', 23); + * ``` + * @param mixed|null $value The optional value to try and match. + * + * @param string $transient The transient name. + * @return void + * + * @throws JsonException|ModuleException + * + */ + public function dontSeeSiteTransientInDatabase(string $transient, mixed $value = null): void + { + $currentBlogId = $this->blogId; + $this->useMainBlog(); + $transient = $this->normalizePrefixedOptionName($transient, '_site_transient_'); + $this->dontSeeOptionInDatabase($transient, $value); + $this->useBlog($currentBlogId); + } + + /** + * Checks that a site transient is in the database. + * + * @example + * ```php + * $I->haveSiteTransientInDatabase('foo', 23); + * $I->seeSiteTransientInDatabase('foo'); + * $I->seeSiteTransientInDatabase('foo', 23); + * ``` + * @param mixed|null $value The optional value to try and match. + * + * @param string $transient The transient name. + * @return void + * @throws JsonException|ModuleException + * + */ + public function seeSiteTransientInDatabase(string $transient, mixed $value = null): void + { + $currentBlogId = $this->blogId; + $this->useMainBlog(); + $transient = $this->normalizePrefixedOptionName($transient, '_site_transient_'); + $this->seeOptionInDatabase($transient, $value); + $this->useBlog($currentBlogId); + } } diff --git a/tests/_support/_generated/AcceptanceTesterActions.php b/tests/_support/_generated/AcceptanceTesterActions.php index 6f4974f60..0184b3daa 100644 --- a/tests/_support/_generated/AcceptanceTesterActions.php +++ b/tests/_support/_generated/AcceptanceTesterActions.php @@ -1,4 +1,4 @@ -haveTransientInDatabase('foo', 23); + * $transientValue = $I->grabTransientFromDatabase('foo'); + * $I->assertEquals(23, $transientValue); + * ``` + * @param string $transient The transient name. + * + * @return mixed The transient value; it will be unserialized if it was serialized. + * + * @see \lucatume\WPBrowser\Module\WPDb::grabTransientFromDatabase() + */ + public function grabTransientFromDatabase(string $transient): mixed { + return $this->getScenario()->runStep(new \Codeception\Step\Action('grabTransientFromDatabase', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that a transient is not in the database. + * + * @example + * ```php + * $I->dontSeeTransientInDatabase('foo'); + * $I->dontSeeTransientInDatabase('foo', 23); + * ``` + * @param mixed $value The optional value to try and match. + * + * @param string $transient The transient name. + * @return void + * @throws JsonException + * + * @see \lucatume\WPBrowser\Module\WPDb::dontSeeTransientInDatabase() + */ + public function dontSeeTransientInDatabase(string $transient, mixed $value = NULL): void { + $this->getScenario()->runStep(new \Codeception\Step\Action('dontSeeTransientInDatabase', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * [!] Conditional Assertion: Test won't be stopped on fail + * Checks that a transient is not in the database. + * + * @example + * ```php + * $I->dontSeeTransientInDatabase('foo'); + * $I->dontSeeTransientInDatabase('foo', 23); + * ``` + * @param mixed $value The optional value to try and match. + * + * @param string $transient The transient name. + * @return void + * @throws JsonException + * + * @see \lucatume\WPBrowser\Module\WPDb::dontSeeTransientInDatabase() + */ + public function cantSeeTransientInDatabase(string $transient, mixed $value = NULL): void { + $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeTransientInDatabase', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that a transient is in the database. + * + * @example + * ```php + * $I->haveTransientInDatabase('foo', 23); + * $I->seeTransientInDatabase('foo'); + * $I->seeTransientInDatabase('foo', 23); + * ``` + * @param mixed $value The optional value to try and match. + * + * @param string $name The transient name. + * @return void + * @throws JsonException + * + * @see \lucatume\WPBrowser\Module\WPDb::seeTransientInDatabase() + */ + public function seeTransientInDatabase(string $name, mixed $value = NULL): void { + $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeTransientInDatabase', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * [!] Conditional Assertion: Test won't be stopped on fail + * Checks that a transient is in the database. + * + * @example + * ```php + * $I->haveTransientInDatabase('foo', 23); + * $I->seeTransientInDatabase('foo'); + * $I->seeTransientInDatabase('foo', 23); + * ``` + * @param mixed $value The optional value to try and match. + * + * @param string $name The transient name. + * @return void + * @throws JsonException + * + * @see \lucatume\WPBrowser\Module\WPDb::seeTransientInDatabase() + */ + public function canSeeTransientInDatabase(string $name, mixed $value = NULL): void { + $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeTransientInDatabase', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that a site transient is not in the database. + * + * @example + * ```php + * $I->dontSeeSiteTransientInDatabase('foo'); + * $I->dontSeeSiteTransientInDatabase('foo', 23); + * ``` + * @param mixed|null $value The optional value to try and match. + * + * @param string $transient The transient name. + * @return void + * + * @throws JsonException|ModuleException + * + * @see \lucatume\WPBrowser\Module\WPDb::dontSeeSiteTransientInDatabase() + */ + public function dontSeeSiteTransientInDatabase(string $transient, mixed $value = NULL): void { + $this->getScenario()->runStep(new \Codeception\Step\Action('dontSeeSiteTransientInDatabase', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * [!] Conditional Assertion: Test won't be stopped on fail + * Checks that a site transient is not in the database. + * + * @example + * ```php + * $I->dontSeeSiteTransientInDatabase('foo'); + * $I->dontSeeSiteTransientInDatabase('foo', 23); + * ``` + * @param mixed|null $value The optional value to try and match. + * + * @param string $transient The transient name. + * @return void + * + * @throws JsonException|ModuleException + * + * @see \lucatume\WPBrowser\Module\WPDb::dontSeeSiteTransientInDatabase() + */ + public function cantSeeSiteTransientInDatabase(string $transient, mixed $value = NULL): void { + $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeSiteTransientInDatabase', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that a site transient is in the database. + * + * @example + * ```php + * $I->haveSiteTransientInDatabase('foo', 23); + * $I->seeSiteTransientInDatabase('foo'); + * $I->seeSiteTransientInDatabase('foo', 23); + * ``` + * @param mixed|null $value The optional value to try and match. + * + * @param string $transient The transient name. + * @return void + * @throws JsonException|ModuleException + * + * @see \lucatume\WPBrowser\Module\WPDb::seeSiteTransientInDatabase() + */ + public function seeSiteTransientInDatabase(string $transient, mixed $value = NULL): void { + $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeSiteTransientInDatabase', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * [!] Conditional Assertion: Test won't be stopped on fail + * Checks that a site transient is in the database. + * + * @example + * ```php + * $I->haveSiteTransientInDatabase('foo', 23); + * $I->seeSiteTransientInDatabase('foo'); + * $I->seeSiteTransientInDatabase('foo', 23); + * ``` + * @param mixed|null $value The optional value to try and match. + * + * @param string $transient The transient name. + * @return void + * @throws JsonException|ModuleException + * + * @see \lucatume\WPBrowser\Module\WPDb::seeSiteTransientInDatabase() + */ + public function canSeeSiteTransientInDatabase(string $transient, mixed $value = NULL): void { + $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeSiteTransientInDatabase', func_get_args())); + } + + /** * [!] Method is generated. Documentation taken from corresponding module. * diff --git a/tests/_support/_generated/ClimoduleTesterActions.php b/tests/_support/_generated/ClimoduleTesterActions.php index 13e2f7fd8..ae7bc44d1 100644 --- a/tests/_support/_generated/ClimoduleTesterActions.php +++ b/tests/_support/_generated/ClimoduleTesterActions.php @@ -1,4 +1,4 @@ -grabpostmetatablename(); + * ``` php + * $postmeta = $I->grabpostmetatablename(); * $thumbnailId = $I->grabFromDatabase($postmeta, 'meta_value', [ * 'post_id' => $id, * 'meta_key'=>'thumbnail_id' @@ -4538,6 +4538,214 @@ public function cantSeeSiteOptionInDatabase(array|string $criteriaOrName, mixed } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Fetches the value of a transient from the database. + * + * @example + * ```php + * $I->haveTransientInDatabase('foo', 23); + * $transientValue = $I->grabTransientFromDatabase('foo'); + * $I->assertEquals(23, $transientValue); + * ``` + * @param string $transient The transient name. + * + * @return mixed The transient value; it will be unserialized if it was serialized. + * + * @see \lucatume\WPBrowser\Module\WPDb::grabTransientFromDatabase() + */ + public function grabTransientFromDatabase(string $transient): mixed { + return $this->getScenario()->runStep(new \Codeception\Step\Action('grabTransientFromDatabase', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that a transient is not in the database. + * + * @example + * ```php + * $I->dontSeeTransientInDatabase('foo'); + * $I->dontSeeTransientInDatabase('foo', 23); + * ``` + * @param mixed $value The optional value to try and match. + * + * @param string $transient The transient name. + * @return void + * @throws JsonException + * + * @see \lucatume\WPBrowser\Module\WPDb::dontSeeTransientInDatabase() + */ + public function dontSeeTransientInDatabase(string $transient, mixed $value = NULL): void { + $this->getScenario()->runStep(new \Codeception\Step\Action('dontSeeTransientInDatabase', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * [!] Conditional Assertion: Test won't be stopped on fail + * Checks that a transient is not in the database. + * + * @example + * ```php + * $I->dontSeeTransientInDatabase('foo'); + * $I->dontSeeTransientInDatabase('foo', 23); + * ``` + * @param mixed $value The optional value to try and match. + * + * @param string $transient The transient name. + * @return void + * @throws JsonException + * + * @see \lucatume\WPBrowser\Module\WPDb::dontSeeTransientInDatabase() + */ + public function cantSeeTransientInDatabase(string $transient, mixed $value = NULL): void { + $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeTransientInDatabase', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that a transient is in the database. + * + * @example + * ```php + * $I->haveTransientInDatabase('foo', 23); + * $I->seeTransientInDatabase('foo'); + * $I->seeTransientInDatabase('foo', 23); + * ``` + * @param mixed $value The optional value to try and match. + * + * @param string $name The transient name. + * @return void + * @throws JsonException + * + * @see \lucatume\WPBrowser\Module\WPDb::seeTransientInDatabase() + */ + public function seeTransientInDatabase(string $name, mixed $value = NULL): void { + $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeTransientInDatabase', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * [!] Conditional Assertion: Test won't be stopped on fail + * Checks that a transient is in the database. + * + * @example + * ```php + * $I->haveTransientInDatabase('foo', 23); + * $I->seeTransientInDatabase('foo'); + * $I->seeTransientInDatabase('foo', 23); + * ``` + * @param mixed $value The optional value to try and match. + * + * @param string $name The transient name. + * @return void + * @throws JsonException + * + * @see \lucatume\WPBrowser\Module\WPDb::seeTransientInDatabase() + */ + public function canSeeTransientInDatabase(string $name, mixed $value = NULL): void { + $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeTransientInDatabase', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that a site transient is not in the database. + * + * @example + * ```php + * $I->dontSeeSiteTransientInDatabase('foo'); + * $I->dontSeeSiteTransientInDatabase('foo', 23); + * ``` + * @param mixed|null $value The optional value to try and match. + * + * @param string $transient The transient name. + * @return void + * + * @throws JsonException|ModuleException + * + * @see \lucatume\WPBrowser\Module\WPDb::dontSeeSiteTransientInDatabase() + */ + public function dontSeeSiteTransientInDatabase(string $transient, mixed $value = NULL): void { + $this->getScenario()->runStep(new \Codeception\Step\Action('dontSeeSiteTransientInDatabase', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * [!] Conditional Assertion: Test won't be stopped on fail + * Checks that a site transient is not in the database. + * + * @example + * ```php + * $I->dontSeeSiteTransientInDatabase('foo'); + * $I->dontSeeSiteTransientInDatabase('foo', 23); + * ``` + * @param mixed|null $value The optional value to try and match. + * + * @param string $transient The transient name. + * @return void + * + * @throws JsonException|ModuleException + * + * @see \lucatume\WPBrowser\Module\WPDb::dontSeeSiteTransientInDatabase() + */ + public function cantSeeSiteTransientInDatabase(string $transient, mixed $value = NULL): void { + $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeSiteTransientInDatabase', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that a site transient is in the database. + * + * @example + * ```php + * $I->haveSiteTransientInDatabase('foo', 23); + * $I->seeSiteTransientInDatabase('foo'); + * $I->seeSiteTransientInDatabase('foo', 23); + * ``` + * @param mixed|null $value The optional value to try and match. + * + * @param string $transient The transient name. + * @return void + * @throws JsonException|ModuleException + * + * @see \lucatume\WPBrowser\Module\WPDb::seeSiteTransientInDatabase() + */ + public function seeSiteTransientInDatabase(string $transient, mixed $value = NULL): void { + $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeSiteTransientInDatabase', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * [!] Conditional Assertion: Test won't be stopped on fail + * Checks that a site transient is in the database. + * + * @example + * ```php + * $I->haveSiteTransientInDatabase('foo', 23); + * $I->seeSiteTransientInDatabase('foo'); + * $I->seeSiteTransientInDatabase('foo', 23); + * ``` + * @param mixed|null $value The optional value to try and match. + * + * @param string $transient The transient name. + * @return void + * @throws JsonException|ModuleException + * + * @see \lucatume\WPBrowser\Module\WPDb::seeSiteTransientInDatabase() + */ + public function canSeeSiteTransientInDatabase(string $transient, mixed $value = NULL): void { + $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeSiteTransientInDatabase', func_get_args())); + } + + /** * [!] Method is generated. Documentation taken from corresponding module. * @@ -7752,6 +7960,31 @@ public function amEditingPostWithId(int $id): void { } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Go to the admin page to edit the user with the specified ID. + * + * The method will **not** handle authentication the admin area. + * + * @example + * ```php + * $I->loginAsAdmin(); + * $userId = $I->haveUserInDatabase('luca', 'editor'); + * $I->amEditingUserWithId($userId); + * $I->fillField('email', 'new@example.net'); + * ``` + * + * @param int $id The user ID. + * + * @return void + * @see \lucatume\WPBrowser\Module\WPBrowser::amEditingUserWithId() + */ + public function amEditingUserWithId(int $id): void { + $this->getScenario()->runStep(new \Codeception\Step\Condition('amEditingUserWithId', func_get_args())); + } + + /** * [!] Method is generated. Documentation taken from corresponding module. * diff --git a/tests/_support/_generated/FunctionalTesterActions.php b/tests/_support/_generated/FunctionalTesterActions.php index e40f4ca6a..79c391a51 100644 --- a/tests/_support/_generated/FunctionalTesterActions.php +++ b/tests/_support/_generated/FunctionalTesterActions.php @@ -1,4 +1,4 @@ -grabpostmetatablename(); + * ``` php + * $postmeta = $I->grabpostmetatablename(); * $thumbnailId = $I->grabFromDatabase($postmeta, 'meta_value', [ * 'post_id' => $id, * 'meta_key'=>'thumbnail_id' @@ -4104,6 +4104,214 @@ public function cantSeeSiteOptionInDatabase(array|string $criteriaOrName, mixed } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Fetches the value of a transient from the database. + * + * @example + * ```php + * $I->haveTransientInDatabase('foo', 23); + * $transientValue = $I->grabTransientFromDatabase('foo'); + * $I->assertEquals(23, $transientValue); + * ``` + * @param string $transient The transient name. + * + * @return mixed The transient value; it will be unserialized if it was serialized. + * + * @see \lucatume\WPBrowser\Module\WPDb::grabTransientFromDatabase() + */ + public function grabTransientFromDatabase(string $transient): mixed { + return $this->getScenario()->runStep(new \Codeception\Step\Action('grabTransientFromDatabase', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that a transient is not in the database. + * + * @example + * ```php + * $I->dontSeeTransientInDatabase('foo'); + * $I->dontSeeTransientInDatabase('foo', 23); + * ``` + * @param mixed $value The optional value to try and match. + * + * @param string $transient The transient name. + * @return void + * @throws JsonException + * + * @see \lucatume\WPBrowser\Module\WPDb::dontSeeTransientInDatabase() + */ + public function dontSeeTransientInDatabase(string $transient, mixed $value = NULL): void { + $this->getScenario()->runStep(new \Codeception\Step\Action('dontSeeTransientInDatabase', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * [!] Conditional Assertion: Test won't be stopped on fail + * Checks that a transient is not in the database. + * + * @example + * ```php + * $I->dontSeeTransientInDatabase('foo'); + * $I->dontSeeTransientInDatabase('foo', 23); + * ``` + * @param mixed $value The optional value to try and match. + * + * @param string $transient The transient name. + * @return void + * @throws JsonException + * + * @see \lucatume\WPBrowser\Module\WPDb::dontSeeTransientInDatabase() + */ + public function cantSeeTransientInDatabase(string $transient, mixed $value = NULL): void { + $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeTransientInDatabase', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that a transient is in the database. + * + * @example + * ```php + * $I->haveTransientInDatabase('foo', 23); + * $I->seeTransientInDatabase('foo'); + * $I->seeTransientInDatabase('foo', 23); + * ``` + * @param mixed $value The optional value to try and match. + * + * @param string $name The transient name. + * @return void + * @throws JsonException + * + * @see \lucatume\WPBrowser\Module\WPDb::seeTransientInDatabase() + */ + public function seeTransientInDatabase(string $name, mixed $value = NULL): void { + $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeTransientInDatabase', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * [!] Conditional Assertion: Test won't be stopped on fail + * Checks that a transient is in the database. + * + * @example + * ```php + * $I->haveTransientInDatabase('foo', 23); + * $I->seeTransientInDatabase('foo'); + * $I->seeTransientInDatabase('foo', 23); + * ``` + * @param mixed $value The optional value to try and match. + * + * @param string $name The transient name. + * @return void + * @throws JsonException + * + * @see \lucatume\WPBrowser\Module\WPDb::seeTransientInDatabase() + */ + public function canSeeTransientInDatabase(string $name, mixed $value = NULL): void { + $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeTransientInDatabase', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that a site transient is not in the database. + * + * @example + * ```php + * $I->dontSeeSiteTransientInDatabase('foo'); + * $I->dontSeeSiteTransientInDatabase('foo', 23); + * ``` + * @param mixed|null $value The optional value to try and match. + * + * @param string $transient The transient name. + * @return void + * + * @throws JsonException|ModuleException + * + * @see \lucatume\WPBrowser\Module\WPDb::dontSeeSiteTransientInDatabase() + */ + public function dontSeeSiteTransientInDatabase(string $transient, mixed $value = NULL): void { + $this->getScenario()->runStep(new \Codeception\Step\Action('dontSeeSiteTransientInDatabase', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * [!] Conditional Assertion: Test won't be stopped on fail + * Checks that a site transient is not in the database. + * + * @example + * ```php + * $I->dontSeeSiteTransientInDatabase('foo'); + * $I->dontSeeSiteTransientInDatabase('foo', 23); + * ``` + * @param mixed|null $value The optional value to try and match. + * + * @param string $transient The transient name. + * @return void + * + * @throws JsonException|ModuleException + * + * @see \lucatume\WPBrowser\Module\WPDb::dontSeeSiteTransientInDatabase() + */ + public function cantSeeSiteTransientInDatabase(string $transient, mixed $value = NULL): void { + $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeSiteTransientInDatabase', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that a site transient is in the database. + * + * @example + * ```php + * $I->haveSiteTransientInDatabase('foo', 23); + * $I->seeSiteTransientInDatabase('foo'); + * $I->seeSiteTransientInDatabase('foo', 23); + * ``` + * @param mixed|null $value The optional value to try and match. + * + * @param string $transient The transient name. + * @return void + * @throws JsonException|ModuleException + * + * @see \lucatume\WPBrowser\Module\WPDb::seeSiteTransientInDatabase() + */ + public function seeSiteTransientInDatabase(string $transient, mixed $value = NULL): void { + $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeSiteTransientInDatabase', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * [!] Conditional Assertion: Test won't be stopped on fail + * Checks that a site transient is in the database. + * + * @example + * ```php + * $I->haveSiteTransientInDatabase('foo', 23); + * $I->seeSiteTransientInDatabase('foo'); + * $I->seeSiteTransientInDatabase('foo', 23); + * ``` + * @param mixed|null $value The optional value to try and match. + * + * @param string $transient The transient name. + * @return void + * @throws JsonException|ModuleException + * + * @see \lucatume\WPBrowser\Module\WPDb::seeSiteTransientInDatabase() + */ + public function canSeeSiteTransientInDatabase(string $transient, mixed $value = NULL): void { + $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeSiteTransientInDatabase', func_get_args())); + } + + /** * [!] Method is generated. Documentation taken from corresponding module. * diff --git a/tests/_support/_generated/WebDriverTesterActions.php b/tests/_support/_generated/WebDriverTesterActions.php index 7b4dd4a90..5b56f4815 100644 --- a/tests/_support/_generated/WebDriverTesterActions.php +++ b/tests/_support/_generated/WebDriverTesterActions.php @@ -1,4 +1,4 @@ -haveTransientInDatabase('foo', 23); + * $transientValue = $I->grabTransientFromDatabase('foo'); + * $I->assertEquals(23, $transientValue); + * ``` + * @param string $transient The transient name. + * + * @return mixed The transient value; it will be unserialized if it was serialized. + * + * @see \lucatume\WPBrowser\Module\WPDb::grabTransientFromDatabase() + */ + public function grabTransientFromDatabase(string $transient): mixed { + return $this->getScenario()->runStep(new \Codeception\Step\Action('grabTransientFromDatabase', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that a transient is not in the database. + * + * @example + * ```php + * $I->dontSeeTransientInDatabase('foo'); + * $I->dontSeeTransientInDatabase('foo', 23); + * ``` + * @param mixed $value The optional value to try and match. + * + * @param string $transient The transient name. + * @return void + * @throws JsonException + * + * @see \lucatume\WPBrowser\Module\WPDb::dontSeeTransientInDatabase() + */ + public function dontSeeTransientInDatabase(string $transient, mixed $value = NULL): void { + $this->getScenario()->runStep(new \Codeception\Step\Action('dontSeeTransientInDatabase', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * [!] Conditional Assertion: Test won't be stopped on fail + * Checks that a transient is not in the database. + * + * @example + * ```php + * $I->dontSeeTransientInDatabase('foo'); + * $I->dontSeeTransientInDatabase('foo', 23); + * ``` + * @param mixed $value The optional value to try and match. + * + * @param string $transient The transient name. + * @return void + * @throws JsonException + * + * @see \lucatume\WPBrowser\Module\WPDb::dontSeeTransientInDatabase() + */ + public function cantSeeTransientInDatabase(string $transient, mixed $value = NULL): void { + $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeTransientInDatabase', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that a transient is in the database. + * + * @example + * ```php + * $I->haveTransientInDatabase('foo', 23); + * $I->seeTransientInDatabase('foo'); + * $I->seeTransientInDatabase('foo', 23); + * ``` + * @param mixed $value The optional value to try and match. + * + * @param string $name The transient name. + * @return void + * @throws JsonException + * + * @see \lucatume\WPBrowser\Module\WPDb::seeTransientInDatabase() + */ + public function seeTransientInDatabase(string $name, mixed $value = NULL): void { + $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeTransientInDatabase', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * [!] Conditional Assertion: Test won't be stopped on fail + * Checks that a transient is in the database. + * + * @example + * ```php + * $I->haveTransientInDatabase('foo', 23); + * $I->seeTransientInDatabase('foo'); + * $I->seeTransientInDatabase('foo', 23); + * ``` + * @param mixed $value The optional value to try and match. + * + * @param string $name The transient name. + * @return void + * @throws JsonException + * + * @see \lucatume\WPBrowser\Module\WPDb::seeTransientInDatabase() + */ + public function canSeeTransientInDatabase(string $name, mixed $value = NULL): void { + $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeTransientInDatabase', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that a site transient is not in the database. + * + * @example + * ```php + * $I->dontSeeSiteTransientInDatabase('foo'); + * $I->dontSeeSiteTransientInDatabase('foo', 23); + * ``` + * @param mixed|null $value The optional value to try and match. + * + * @param string $transient The transient name. + * @return void + * + * @throws JsonException|ModuleException + * + * @see \lucatume\WPBrowser\Module\WPDb::dontSeeSiteTransientInDatabase() + */ + public function dontSeeSiteTransientInDatabase(string $transient, mixed $value = NULL): void { + $this->getScenario()->runStep(new \Codeception\Step\Action('dontSeeSiteTransientInDatabase', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * [!] Conditional Assertion: Test won't be stopped on fail + * Checks that a site transient is not in the database. + * + * @example + * ```php + * $I->dontSeeSiteTransientInDatabase('foo'); + * $I->dontSeeSiteTransientInDatabase('foo', 23); + * ``` + * @param mixed|null $value The optional value to try and match. + * + * @param string $transient The transient name. + * @return void + * + * @throws JsonException|ModuleException + * + * @see \lucatume\WPBrowser\Module\WPDb::dontSeeSiteTransientInDatabase() + */ + public function cantSeeSiteTransientInDatabase(string $transient, mixed $value = NULL): void { + $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeSiteTransientInDatabase', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that a site transient is in the database. + * + * @example + * ```php + * $I->haveSiteTransientInDatabase('foo', 23); + * $I->seeSiteTransientInDatabase('foo'); + * $I->seeSiteTransientInDatabase('foo', 23); + * ``` + * @param mixed|null $value The optional value to try and match. + * + * @param string $transient The transient name. + * @return void + * @throws JsonException|ModuleException + * + * @see \lucatume\WPBrowser\Module\WPDb::seeSiteTransientInDatabase() + */ + public function seeSiteTransientInDatabase(string $transient, mixed $value = NULL): void { + $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeSiteTransientInDatabase', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * [!] Conditional Assertion: Test won't be stopped on fail + * Checks that a site transient is in the database. + * + * @example + * ```php + * $I->haveSiteTransientInDatabase('foo', 23); + * $I->seeSiteTransientInDatabase('foo'); + * $I->seeSiteTransientInDatabase('foo', 23); + * ``` + * @param mixed|null $value The optional value to try and match. + * + * @param string $transient The transient name. + * @return void + * @throws JsonException|ModuleException + * + * @see \lucatume\WPBrowser\Module\WPDb::seeSiteTransientInDatabase() + */ + public function canSeeSiteTransientInDatabase(string $transient, mixed $value = NULL): void { + $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeSiteTransientInDatabase', func_get_args())); + } + + /** * [!] Method is generated. Documentation taken from corresponding module. * diff --git a/tests/_support/_generated/Wpcli_moduleTesterActions.php b/tests/_support/_generated/Wpcli_moduleTesterActions.php index 482cf5b59..28baa3450 100644 --- a/tests/_support/_generated/Wpcli_moduleTesterActions.php +++ b/tests/_support/_generated/Wpcli_moduleTesterActions.php @@ -1,4 +1,4 @@ -grabpostmetatablename(); + * ``` php + * $postmeta = $I->grabpostmetatablename(); * $thumbnailId = $I->grabFromDatabase($postmeta, 'meta_value', [ * 'post_id' => $id, * 'meta_key'=>'thumbnail_id' @@ -4104,6 +4104,214 @@ public function cantSeeSiteOptionInDatabase(array|string $criteriaOrName, mixed } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Fetches the value of a transient from the database. + * + * @example + * ```php + * $I->haveTransientInDatabase('foo', 23); + * $transientValue = $I->grabTransientFromDatabase('foo'); + * $I->assertEquals(23, $transientValue); + * ``` + * @param string $transient The transient name. + * + * @return mixed The transient value; it will be unserialized if it was serialized. + * + * @see \lucatume\WPBrowser\Module\WPDb::grabTransientFromDatabase() + */ + public function grabTransientFromDatabase(string $transient): mixed { + return $this->getScenario()->runStep(new \Codeception\Step\Action('grabTransientFromDatabase', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that a transient is not in the database. + * + * @example + * ```php + * $I->dontSeeTransientInDatabase('foo'); + * $I->dontSeeTransientInDatabase('foo', 23); + * ``` + * @param mixed $value The optional value to try and match. + * + * @param string $transient The transient name. + * @return void + * @throws JsonException + * + * @see \lucatume\WPBrowser\Module\WPDb::dontSeeTransientInDatabase() + */ + public function dontSeeTransientInDatabase(string $transient, mixed $value = NULL): void { + $this->getScenario()->runStep(new \Codeception\Step\Action('dontSeeTransientInDatabase', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * [!] Conditional Assertion: Test won't be stopped on fail + * Checks that a transient is not in the database. + * + * @example + * ```php + * $I->dontSeeTransientInDatabase('foo'); + * $I->dontSeeTransientInDatabase('foo', 23); + * ``` + * @param mixed $value The optional value to try and match. + * + * @param string $transient The transient name. + * @return void + * @throws JsonException + * + * @see \lucatume\WPBrowser\Module\WPDb::dontSeeTransientInDatabase() + */ + public function cantSeeTransientInDatabase(string $transient, mixed $value = NULL): void { + $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeTransientInDatabase', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that a transient is in the database. + * + * @example + * ```php + * $I->haveTransientInDatabase('foo', 23); + * $I->seeTransientInDatabase('foo'); + * $I->seeTransientInDatabase('foo', 23); + * ``` + * @param mixed $value The optional value to try and match. + * + * @param string $name The transient name. + * @return void + * @throws JsonException + * + * @see \lucatume\WPBrowser\Module\WPDb::seeTransientInDatabase() + */ + public function seeTransientInDatabase(string $name, mixed $value = NULL): void { + $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeTransientInDatabase', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * [!] Conditional Assertion: Test won't be stopped on fail + * Checks that a transient is in the database. + * + * @example + * ```php + * $I->haveTransientInDatabase('foo', 23); + * $I->seeTransientInDatabase('foo'); + * $I->seeTransientInDatabase('foo', 23); + * ``` + * @param mixed $value The optional value to try and match. + * + * @param string $name The transient name. + * @return void + * @throws JsonException + * + * @see \lucatume\WPBrowser\Module\WPDb::seeTransientInDatabase() + */ + public function canSeeTransientInDatabase(string $name, mixed $value = NULL): void { + $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeTransientInDatabase', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that a site transient is not in the database. + * + * @example + * ```php + * $I->dontSeeSiteTransientInDatabase('foo'); + * $I->dontSeeSiteTransientInDatabase('foo', 23); + * ``` + * @param mixed|null $value The optional value to try and match. + * + * @param string $transient The transient name. + * @return void + * + * @throws JsonException|ModuleException + * + * @see \lucatume\WPBrowser\Module\WPDb::dontSeeSiteTransientInDatabase() + */ + public function dontSeeSiteTransientInDatabase(string $transient, mixed $value = NULL): void { + $this->getScenario()->runStep(new \Codeception\Step\Action('dontSeeSiteTransientInDatabase', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * [!] Conditional Assertion: Test won't be stopped on fail + * Checks that a site transient is not in the database. + * + * @example + * ```php + * $I->dontSeeSiteTransientInDatabase('foo'); + * $I->dontSeeSiteTransientInDatabase('foo', 23); + * ``` + * @param mixed|null $value The optional value to try and match. + * + * @param string $transient The transient name. + * @return void + * + * @throws JsonException|ModuleException + * + * @see \lucatume\WPBrowser\Module\WPDb::dontSeeSiteTransientInDatabase() + */ + public function cantSeeSiteTransientInDatabase(string $transient, mixed $value = NULL): void { + $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeSiteTransientInDatabase', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that a site transient is in the database. + * + * @example + * ```php + * $I->haveSiteTransientInDatabase('foo', 23); + * $I->seeSiteTransientInDatabase('foo'); + * $I->seeSiteTransientInDatabase('foo', 23); + * ``` + * @param mixed|null $value The optional value to try and match. + * + * @param string $transient The transient name. + * @return void + * @throws JsonException|ModuleException + * + * @see \lucatume\WPBrowser\Module\WPDb::seeSiteTransientInDatabase() + */ + public function seeSiteTransientInDatabase(string $transient, mixed $value = NULL): void { + $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeSiteTransientInDatabase', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * [!] Conditional Assertion: Test won't be stopped on fail + * Checks that a site transient is in the database. + * + * @example + * ```php + * $I->haveSiteTransientInDatabase('foo', 23); + * $I->seeSiteTransientInDatabase('foo'); + * $I->seeSiteTransientInDatabase('foo', 23); + * ``` + * @param mixed|null $value The optional value to try and match. + * + * @param string $transient The transient name. + * @return void + * @throws JsonException|ModuleException + * + * @see \lucatume\WPBrowser\Module\WPDb::seeSiteTransientInDatabase() + */ + public function canSeeSiteTransientInDatabase(string $transient, mixed $value = NULL): void { + $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeSiteTransientInDatabase', func_get_args())); + } + + /** * [!] Method is generated. Documentation taken from corresponding module. * diff --git a/tests/_support/_generated/WploaderTesterActions.php b/tests/_support/_generated/WploaderTesterActions.php index 34ff4c7c2..184a84a10 100644 --- a/tests/_support/_generated/WploaderTesterActions.php +++ b/tests/_support/_generated/WploaderTesterActions.php @@ -90,7 +90,7 @@ public function getThemesFolder(string $path = ""): string { * [!] Method is generated. Documentation taken from corresponding module. * * Accessor method to get the object storing the factories for things. - * This methods gives access to the same factories provided by the + * This method gives access to the same factories provided by the * [Core test suite](https://make.wordpress.org/core/handbook/testing/automated-testing/writing-phpunit-tests/). * * @return FactoryStore A factory store, proxy to get hold of the Core suite object diff --git a/tests/_support/_generated/Wploader_multisiteTesterActions.php b/tests/_support/_generated/Wploader_multisiteTesterActions.php index ad876b96b..a928dc75b 100644 --- a/tests/_support/_generated/Wploader_multisiteTesterActions.php +++ b/tests/_support/_generated/Wploader_multisiteTesterActions.php @@ -90,7 +90,7 @@ public function getThemesFolder(string $path = ""): string { * [!] Method is generated. Documentation taken from corresponding module. * * Accessor method to get the object storing the factories for things. - * This methods gives access to the same factories provided by the + * This method gives access to the same factories provided by the * [Core test suite](https://make.wordpress.org/core/handbook/testing/automated-testing/writing-phpunit-tests/). * * @return FactoryStore A factory store, proxy to get hold of the Core suite object diff --git a/tests/_support/_generated/Wploader_wpdb_interactionTesterActions.php b/tests/_support/_generated/Wploader_wpdb_interactionTesterActions.php index 440e9a20e..4f6177233 100644 --- a/tests/_support/_generated/Wploader_wpdb_interactionTesterActions.php +++ b/tests/_support/_generated/Wploader_wpdb_interactionTesterActions.php @@ -1,4 +1,4 @@ -grabpostmetatablename(); + * ``` php + * $postmeta = $I->grabpostmetatablename(); * $thumbnailId = $I->grabFromDatabase($postmeta, 'meta_value', [ * 'post_id' => $id, * 'meta_key'=>'thumbnail_id' @@ -4223,6 +4223,214 @@ public function cantSeeSiteOptionInDatabase(array|string $criteriaOrName, mixed } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Fetches the value of a transient from the database. + * + * @example + * ```php + * $I->haveTransientInDatabase('foo', 23); + * $transientValue = $I->grabTransientFromDatabase('foo'); + * $I->assertEquals(23, $transientValue); + * ``` + * @param string $transient The transient name. + * + * @return mixed The transient value; it will be unserialized if it was serialized. + * + * @see \lucatume\WPBrowser\Module\WPDb::grabTransientFromDatabase() + */ + public function grabTransientFromDatabase(string $transient): mixed { + return $this->getScenario()->runStep(new \Codeception\Step\Action('grabTransientFromDatabase', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that a transient is not in the database. + * + * @example + * ```php + * $I->dontSeeTransientInDatabase('foo'); + * $I->dontSeeTransientInDatabase('foo', 23); + * ``` + * @param mixed $value The optional value to try and match. + * + * @param string $transient The transient name. + * @return void + * @throws JsonException + * + * @see \lucatume\WPBrowser\Module\WPDb::dontSeeTransientInDatabase() + */ + public function dontSeeTransientInDatabase(string $transient, mixed $value = NULL): void { + $this->getScenario()->runStep(new \Codeception\Step\Action('dontSeeTransientInDatabase', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * [!] Conditional Assertion: Test won't be stopped on fail + * Checks that a transient is not in the database. + * + * @example + * ```php + * $I->dontSeeTransientInDatabase('foo'); + * $I->dontSeeTransientInDatabase('foo', 23); + * ``` + * @param mixed $value The optional value to try and match. + * + * @param string $transient The transient name. + * @return void + * @throws JsonException + * + * @see \lucatume\WPBrowser\Module\WPDb::dontSeeTransientInDatabase() + */ + public function cantSeeTransientInDatabase(string $transient, mixed $value = NULL): void { + $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeTransientInDatabase', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that a transient is in the database. + * + * @example + * ```php + * $I->haveTransientInDatabase('foo', 23); + * $I->seeTransientInDatabase('foo'); + * $I->seeTransientInDatabase('foo', 23); + * ``` + * @param mixed $value The optional value to try and match. + * + * @param string $name The transient name. + * @return void + * @throws JsonException + * + * @see \lucatume\WPBrowser\Module\WPDb::seeTransientInDatabase() + */ + public function seeTransientInDatabase(string $name, mixed $value = NULL): void { + $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeTransientInDatabase', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * [!] Conditional Assertion: Test won't be stopped on fail + * Checks that a transient is in the database. + * + * @example + * ```php + * $I->haveTransientInDatabase('foo', 23); + * $I->seeTransientInDatabase('foo'); + * $I->seeTransientInDatabase('foo', 23); + * ``` + * @param mixed $value The optional value to try and match. + * + * @param string $name The transient name. + * @return void + * @throws JsonException + * + * @see \lucatume\WPBrowser\Module\WPDb::seeTransientInDatabase() + */ + public function canSeeTransientInDatabase(string $name, mixed $value = NULL): void { + $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeTransientInDatabase', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that a site transient is not in the database. + * + * @example + * ```php + * $I->dontSeeSiteTransientInDatabase('foo'); + * $I->dontSeeSiteTransientInDatabase('foo', 23); + * ``` + * @param mixed|null $value The optional value to try and match. + * + * @param string $transient The transient name. + * @return void + * + * @throws JsonException|ModuleException + * + * @see \lucatume\WPBrowser\Module\WPDb::dontSeeSiteTransientInDatabase() + */ + public function dontSeeSiteTransientInDatabase(string $transient, mixed $value = NULL): void { + $this->getScenario()->runStep(new \Codeception\Step\Action('dontSeeSiteTransientInDatabase', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * [!] Conditional Assertion: Test won't be stopped on fail + * Checks that a site transient is not in the database. + * + * @example + * ```php + * $I->dontSeeSiteTransientInDatabase('foo'); + * $I->dontSeeSiteTransientInDatabase('foo', 23); + * ``` + * @param mixed|null $value The optional value to try and match. + * + * @param string $transient The transient name. + * @return void + * + * @throws JsonException|ModuleException + * + * @see \lucatume\WPBrowser\Module\WPDb::dontSeeSiteTransientInDatabase() + */ + public function cantSeeSiteTransientInDatabase(string $transient, mixed $value = NULL): void { + $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeSiteTransientInDatabase', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that a site transient is in the database. + * + * @example + * ```php + * $I->haveSiteTransientInDatabase('foo', 23); + * $I->seeSiteTransientInDatabase('foo'); + * $I->seeSiteTransientInDatabase('foo', 23); + * ``` + * @param mixed|null $value The optional value to try and match. + * + * @param string $transient The transient name. + * @return void + * @throws JsonException|ModuleException + * + * @see \lucatume\WPBrowser\Module\WPDb::seeSiteTransientInDatabase() + */ + public function seeSiteTransientInDatabase(string $transient, mixed $value = NULL): void { + $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeSiteTransientInDatabase', func_get_args())); + } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * [!] Conditional Assertion: Test won't be stopped on fail + * Checks that a site transient is in the database. + * + * @example + * ```php + * $I->haveSiteTransientInDatabase('foo', 23); + * $I->seeSiteTransientInDatabase('foo'); + * $I->seeSiteTransientInDatabase('foo', 23); + * ``` + * @param mixed|null $value The optional value to try and match. + * + * @param string $transient The transient name. + * @return void + * @throws JsonException|ModuleException + * + * @see \lucatume\WPBrowser\Module\WPDb::seeSiteTransientInDatabase() + */ + public function canSeeSiteTransientInDatabase(string $transient, mixed $value = NULL): void { + $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeSiteTransientInDatabase', func_get_args())); + } + + /** * [!] Method is generated. Documentation taken from corresponding module. * diff --git a/tests/acceptance/TransientOperationsCest.php b/tests/acceptance/TransientOperationsCest.php new file mode 100644 index 000000000..e0f7c444f --- /dev/null +++ b/tests/acceptance/TransientOperationsCest.php @@ -0,0 +1,94 @@ +assertEquals('', $I->grabTransientFromDatabase('a_test_transient')); + $I->dontSeeTransientInDatabase('a_test_transient'); + + $I->haveTransientInDatabase('a_test_transient', 23); + + $I->assertEquals(23, $I->grabTransientFromDatabase('a_test_transient')); + $I->seeTransientInDatabase('a_test_transient'); + $I->seeTransientInDatabase('a_test_transient', 23); + + $I->dontHaveTransientInDatabase('a_test_transient'); + + $I->assertEquals('', $I->grabTransientFromDatabase('a_test_transient')); + $I->dontSeeTransientInDatabase('a_test_transient'); + } + + /** + * It should allow transient operations on a second site + * + * @test + */ + public function should_allow_transient_operations_on_a_second_site(Tester $I): void + { + $I->useBlog(2); + + $I->assertEquals('', $I->grabTransientFromDatabase('a_test_transient')); + $I->dontSeeTransientInDatabase('a_test_transient'); + + $I->haveTransientInDatabase('a_test_transient', 23); + + $I->assertEquals(23, $I->grabTransientFromDatabase('a_test_transient')); + $I->seeTransientInDatabase('a_test_transient'); + $I->seeTransientInDatabase('a_test_transient', 23); + + $I->useMainBlog(); + + $I->assertEquals('', $I->grabTransientFromDatabase('a_test_transient')); + $I->dontSeeTransientInDatabase('a_test_transient'); + + $I->dontHaveTransientInDatabase('a_test_transient'); + + $I->assertEquals('', $I->grabTransientFromDatabase('a_test_transient')); + $I->dontSeeTransientInDatabase('a_test_transient'); + + $I->useBlog(2); + + $I->assertEquals(23, $I->grabTransientFromDatabase('a_test_transient')); + $I->seeTransientInDatabase('a_test_transient'); + $I->seeTransientInDatabase('a_test_transient', 23); + + $I->dontHaveTransientInDatabase('a_test_transient'); + + $I->assertEquals('', $I->grabTransientFromDatabase('a_test_transient')); + $I->dontSeeTransientInDatabase('a_test_transient'); + } + + /** + * It should allow site transient operations + * + * @test + */ + public function should_allow_site_transient_operations(Tester $I): void + { + $I->assertEquals('', $I->grabSiteTransientFromDatabase('a_test_transient')); + $I->dontSeeSiteTransientInDatabase('a_test_transient'); + + $I->haveSiteTransientInDatabase('a_test_transient', 23); + + $I->assertEquals(23, $I->grabSiteTransientFromDatabase('a_test_transient')); + $I->seeSiteTransientInDatabase('a_test_transient'); + $I->seeSiteTransientInDatabase('a_test_transient', 23); + + $I->dontHaveSiteTransientInDatabase('a_test_transient'); + + $I->assertEquals('', $I->grabSiteTransientFromDatabase('a_test_transient')); + $I->dontSeeSiteTransientInDatabase('a_test_transient'); + $I->dontSeeSiteTransientInDatabase('a_test_transient', 23); + } +} From 76e245ed59afb9c949beb12501ab9bbb63152a87 Mon Sep 17 00:00:00 2001 From: Luca Tumedei Date: Sat, 14 Oct 2023 10:55:01 +0200 Subject: [PATCH 2/4] build(.github) correct error in workflow file --- .github/workflows/phpcbf.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/phpcbf.yml b/.github/workflows/phpcbf.yml index 6cbe0bff4..1ad4f5b90 100644 --- a/.github/workflows/phpcbf.yml +++ b/.github/workflows/phpcbf.yml @@ -10,7 +10,7 @@ on: # yamllint disable-line rule:truthy - ".github/workflows/phpcbf.yml" push: paths: - - "src/**"J + - "src/**" - "includes/**" - ".github/workflows/phpcbf.yml" branches: From 224158caedf225debdbd29ffa101b05668140e80 Mon Sep 17 00:00:00 2001 From: Luca Tumedei Date: Sat, 14 Oct 2023 11:01:55 +0200 Subject: [PATCH 3/4] doc(CNAME) add file to avoid custom domain reset on deploy --- docs/CNAME | 1 + 1 file changed, 1 insertion(+) create mode 100644 docs/CNAME diff --git a/docs/CNAME b/docs/CNAME new file mode 100644 index 000000000..cdcfdff63 --- /dev/null +++ b/docs/CNAME @@ -0,0 +1 @@ +wpbrowser.wptestkit.dev From 78a5b5a691170a27b807a75ae063131e1ba3a87e Mon Sep 17 00:00:00 2001 From: Luca Tumedei Date: Sat, 14 Oct 2023 11:10:55 +0200 Subject: [PATCH 4/4] build(.github) format include paths with single quotes skip-ci --- .github/workflows/docs.yml | 12 ++++++------ .github/workflows/phpcbf.yml | 12 ++++++------ .github/workflows/static-analysis.yml | 20 ++++++++++---------- .github/workflows/test.yaml | 20 ++++++++++---------- 4 files changed, 32 insertions(+), 32 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index c1c62b3af..3609c838b 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -2,14 +2,14 @@ name: docs on: pull_request: paths: - - "docs/**" - - "mkdocs.yml" - - ".github/workflows/docs.yml" + - 'docs/**' + - 'mkdocs.yml' + - '.github/workflows/docs.yml' push: paths: - - "docs/**" - - "mkdocs.yml" - - ".github/workflows/docs.yml" + - 'docs/**' + - 'mkdocs.yml' + - '.github/workflows/docs.yml' branches: - master permissions: diff --git a/.github/workflows/phpcbf.yml b/.github/workflows/phpcbf.yml index 1ad4f5b90..027a73696 100644 --- a/.github/workflows/phpcbf.yml +++ b/.github/workflows/phpcbf.yml @@ -5,14 +5,14 @@ name: "PHPCBF automatically fix violations" on: # yamllint disable-line rule:truthy pull_request: paths: - - "src/**" - - "includes/**" - - ".github/workflows/phpcbf.yml" + - 'src/**' + - 'includes/**' + - '.github/workflows/phpcbf.yml' push: paths: - - "src/**" - - "includes/**" - - ".github/workflows/phpcbf.yml" + - 'src/**' + - 'includes/**' + - '.github/workflows/phpcbf.yml' branches: - master diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index fa941be34..49e5a3fd0 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -5,18 +5,18 @@ name: "Static Analysis" on: # yamllint disable-line rule:truthy pull_request: paths: - - "src/**" - - "includes/**" - - "tests/**" - - "composer.json" - - ".github/workflows/static-analysis.yml" + - 'src/**' + - 'includes/**' + - 'tests/**' + - 'composer.json' + - '.github/workflows/static-analysis.yml' push: paths: - - "src/**" - - "includes/**" - - "tests/**" - - "composer.json" - - ".github/workflows/static-analysis.yml" + - 'src/**' + - 'includes/**' + - 'tests/**' + - 'composer.json' + - '.github/workflows/static-analysis.yml' branches: - "master" diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index f751bf07c..4fa7a9cb7 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -5,18 +5,18 @@ name: Test on: # yamllint disable-line rule:truthy pull_request: paths: - - "src/**" - - "includes/**" - - "tests/**" - - "composer.json" - - ".github/workflows/test.yaml" + - 'src/**' + - 'includes/**' + - 'tests/**' + - 'composer.json' + - '.github/workflows/test.yaml' push: paths: - - "src/**" - - "includes/**" - - "tests/**" - - "composer.json" - - ".github/workflows/test.yaml" + - 'src/**' + - 'includes/**' + - 'tests/**' + - 'composer.json' + - '.github/workflows/test.yaml' branches: - "master"