PHP Class Codeception\Module\WPDb

Inheritance: extends ExtendedDb
Afficher le fichier Open project: lucatume/wp-browser

Protected Properties

Свойство Type Description
$blogId The id of the blog currently used.
$config array The module optional configuration parameters.
$handlebars Handlebars\Handlebars
$isSubdomainMultisiteInstall boolean
$menuItems array
$menus array
$numberPlaceholder string
$requiredFields array url - the site url
$stylesheet The theme stylesheet in use.
$tablePrefix string The table prefix to use.
$tables tad\WPBrowser\Generators\Tables
$templateData array
$termKeys array
$termTaxonomyKeys array
$uniqueTables A list of tables that WordPress will nor replicate in multisite installations.

Méthodes publiques

Méthode Description
_cleanup ( )
_initialize ( Handlebars\Handlebars $handlebars = null, tad\WPBrowser\Generators\Tables $table = null ) Initializes the module.
dontHaveBlogInDatabase ( array $criteria ) Removes an entry from the blogs table.
dontHaveCommentInDatabase ( array $criteria ) Removes an entry from the comments table.
dontHaveCommentMetaInDatabase ( array $criteria ) Removes an entry from the commentmeta table.
dontHaveLinkInDatabase ( array $criteria ) Removes a link from the database.
dontHaveOptionInDatabase ( $key, null $value = null ) : integer Removes an entry from the options table.
dontHavePostInDatabase ( array $criteria ) Removes an entry from the posts table.
dontHavePostMetaInDatabase ( array $criteria ) Removes an entry from the postmeta table.
dontHaveSiteOptionInDatabase ( $key, null $value = null ) Removes a site option from the database.
dontHaveSiteTransientInDatabase ( string $key ) Removes a site transient from the database.
dontHaveTermInDatabase ( array $criteria ) Removes a term from the database.
dontHaveTermMetaInDatabase ( array $criteria ) Removes a term meta from the database.
dontHaveTermRelationshipInDatabase ( array $criteria ) Removes an entry from the term_relationships table.
dontHaveTermTaxonomyInDatabase ( array $criteria ) Removes an entry from the term_taxonomy table.
dontHaveTransientInDatabase ( $transient ) : integer Removes a transient from the database.
dontHaveUserInDatabase ( integer | string $userIdOrLogin ) Removes a user from the database.
dontHaveUserMetaInDatabase ( array $criteria ) Removes an entry from the usermeta table.
dontSeeBlogInDatabase ( array $criteria ) Checks that a row is not present in the blogs table.
dontSeeCommentInDatabase ( array $criteria ) : void Checks that a comment is not in the database.
dontSeeCommentMetaInDatabase ( array $criteria ) : void Checks that a comment meta value is not in the database.
dontSeeLinkInDatabase ( array $criteria ) Checks that a link is not in the database.
dontSeeOptionInDatabase ( array $criteria ) Checks that an option is not in the database for the current blog.
dontSeePageInDatabase ( array $criteria ) Checks that a page is not in the database.
dontSeePostInDatabase ( array $criteria ) Checks that a post is not in the database.
dontSeePostMetaInDatabase ( array $criteria ) Checks that a post meta value is not there.
dontSeeTermInDatabase ( array $criteria ) Makes sure a term is not in the database.
dontSeeTermMetaInDatabase ( array $criteria ) Checks that a term meta is not in the database.
dontSeeTermTaxonomyInDatabase ( array $criteria ) Checks that a term taxonomy is not in the database.
dontSeeUserInDatabase ( array $criteria ) Checks that a user is not in the database.
dontSeeUserMetaInDatabase ( array $criteria ) Check that a user meta value is not in the database.
getSiteDomain ( ) : string Returns the site domain inferred from the url set in the config.
grabAllFromDatabase ( string $table, string $column, array $criteria ) : array Returns all entries matching a criteria from the database.
grabBlogVersionsTableName ( ) : string Gets the prefixed blog_versions table name.
grabBlogsTableName ( ) : string Gets the prefixed blogs table name.
grabCommentmetaTableName ( ) : string Returns the prefixed comment meta table name.
grabCommentsTableName ( ) : string Gets the comments table name.
grabLatestEntryByFromDatabase ( string $tableName, string $idColumn = 'ID' ) : mixed Returns the id value of the last table entry.
grabLinksTableName ( ) : string Returns the prefixed links table name.
grabOptionFromDatabase ( string $option_name ) : mixed | string Gets an option from the database.
grabPostMetaTableName ( ) : string Returns the prefixed post meta table name.
grabPostsTableName ( ) : string Gets the posts table name.
grabPrefixedTableNameFor ( string $tableName = '' ) : string Returns a prefixed table name for the current blog.
grabRegistrationLogTableName ( ) : string Gets the prefixed registration_log table name.
grabSignupsTableName ( ) : string Gets the prefixed signups table name.
grabSiteMetaTableName ( ) : string Gets the prefixed sitemeta table name.
grabSiteOptionFromDatabase ( string $key ) : mixed | string Gets a site option from the database.
grabSiteTableName ( ) : string Gets the prefixed site table name.
grabSiteTransientFromDatabase ( string $key ) : mixed | string Gets a site transient from the database.
grabSiteUrl ( ) : string Returns the current site url as specified in the module configuration.
grabTablePrefix ( ) : string Returns the table prefix, namespaced for secondary blogs if selected.
grabTermIdFromDatabase ( array $criteria ) Gets a term from the database.
grabTermMetaTableName ( ) : string Gets the terms meta table prefixed name.
grabTermRelationshipsTableName ( ) : string Gets the prefixed term relationships table name, e.g. wp_term_relationships.
grabTermTaxonomyIdFromDatabase ( array $criteria ) Gets a term_taxonomy_id from the database.
grabTermTaxonomyTableName ( ) : string Gets the prefixed term and taxonomy table name, e.g. wp_term_taxonomy.
grabTermsTableName ( ) : string Gets the prefixed terms table name, e.g. wp_terms.
grabUserIdFromDatabase ( string $userLogin ) : integer Gets the a user ID from the database using the user login.
grabUserMetaFromDatabase ( integer $userId, string $meta_key ) : array Gets a user meta from the database.
grabUsermetaTableName ( ) : string Returns the prefixed usermeta table name, e.g. wp_usermeta.
haveBlogInDatabase ( string $domainOrPath, array $overrides = [] ) : integer Inserts a blog in the blogs table.
haveCommentInDatabase ( integer $comment_post_ID, array $data = [] ) : integer Inserts a comment in the database.
haveCommentMetaInDatabase ( integer $comment_id, string $meta_key, mixed $meta_value ) : integer Inserts a comment meta field in the database.
haveLinkInDatabase ( array $overrides = [] ) : integer Inserts a link in the database.
haveManyBlogsInDatabase ( integer $count, array $overrides = [] ) : array Inserts many blogs in the database.
haveManyCommentsInDatabase ( integer $count, integer $comment_post_ID, array $overrides = [] ) : int[] Inserts many comments in the database.
haveManyLinksInDatabase ( integer $count, array $overrides = [] ) : array Inserts many links in the database.
haveManyPostsInDatabase ( integer $count, array $overrides = [] ) : array Inserts many posts in the database returning their IDs.
haveManyTermsInDatabase ( integer $count, string $name, string $taxonomy, array $overrides = [] ) : array Inserts many terms in the database.
haveManyUsersInDatabase ( $count, $user_login, $role = 'subscriber', array $overrides = [] )
haveMenuInDatabase ( string $slug, string $location, array $overrides = [] ) : array Creates and adds a menu to a theme location in the database.
haveMenuItemInDatabase ( string $menuSlug, string $title, integer | null $menuOrder = null, array $meta = [] ) : integer Adds a menu element to a menu for the current theme.
haveOptionInDatabase ( string $option_name, mixed $option_value, string $autoload = 'yes' ) : integer Inserts an option in the database.
havePageInDatabase ( array $overrides = [] ) Inserts a page in the database.
havePostInDatabase ( array $data = [] ) : integer Inserts a post in the database.
havePostmetaInDatabase ( integer $post_id, string $meta_key, mixed $meta_value ) : integer Adds one or more meta key and value couples in the database for a post.
haveSiteOptionInDatabase ( string $key, mixed $value ) : integer Inserts a site option in the database.
haveSiteTransientInDatabase ( $key, $value ) Inserts a site transient in the database.
haveTermInDatabase ( string $name, string $taxonomy, array $overrides = [] ) : array Inserts a term in the database.
haveTermMetaInDatabase ( integer $term_id, string $meta_key, mixed $meta_value ) : integer Inserts a term meta row in the database.
haveTermRelationshipInDatabase ( integer $object_id, integer $term_taxonomy_id, integer $term_order ) Creates a term relationship in the database.
haveTransientInDatabase ( string $transient, mixed $value ) : integer Inserts a transient in the database.
haveUserCapabilitiesInDatabase ( integer $userId, string | array $role ) : array Sets a user capabilities.
haveUserInDatabase ( string $user_login, string $role = 'subscriber', array $overrides = [] ) : integer Inserts a user and appropriate meta in the database.
haveUserLevelsInDatabase ( integer $userId, string | array $role ) : array Sets the user level in the database for a user.
haveUserMetaInDatabase ( integer $userId, string $meta_key, mixed $meta_value ) : array Sets a user meta.
replaceSiteDomainInMultisiteSql ( $sql )
replaceSiteDomainInSql ( string $sql ) : string Replaces the WordPress domains in a SQL dump string.
seeBlogInDatabase ( array $criteria ) Checks for a blog in the database, looks up the blogs table.
seeCommentInDatabase ( array $criteria ) : void Checks for a comment in the database.
seeCommentMetaInDatabase ( array $criteria ) : void Checks that a comment meta value is in the database.
seeLinkInDatabase ( array $criteria ) Checks for a link in the database.
seeOptionInDatabase ( array $criteria ) Checks if an option is in the database for the current blog.
seePageInDatabase ( array $criteria ) Checks for a page in the database.
seePostInDatabase ( array $criteria ) Checks for a post in the database.
seePostMetaInDatabase ( array $criteria ) Checks for a post meta value in the database for the current blog.
seePostWithTermInDatabase ( integer $post_id, integer $term_id, integer $term_order ) : void Checks that a post to term relation exists in the database.
seeSiteOptionInDatabase ( string $key, mixed | null $value = null ) Checks that a site option is in the database.
seeSiteSiteTransientInDatabase ( string $key, mixed | null $value = null ) Checks that a site option is in the database.
seeTableInDatabase ( string $table ) Checks for a table in the database.
seeTermInDatabase ( array $criteria ) Checks for a term in the database.
seeTermMetaInDatabase ( array $criteria ) Checks for a term meta in the database.
seeTermRelationshipInDatabase ( array $criteria ) Checks for a term relationship in the database.
seeTermTaxonomyInDatabase ( array $criteria ) Checks for a term taxonomy in the database.
seeUserInDatabase ( array $criteria ) : void Checks that a user is in the database.
seeUserMetaInDatabase ( array $criteria ) Checks for a user meta value in the database.
useBlog ( integer $id ) Sets the blog to be used.
useMainBlog ( ) Sets the current blog to the main one (blog_id 1).
useTheme ( string $stylesheet, string | null $template = null, string | null $themeName = null ) Sets the current theme options.

Méthodes protégées

Méthode Description
_seeTableInDatabase ( $table ) : integer
getSiteSubfolder ( ) : string
getUsersTableName ( ) : string Returns the users table name, e.g. wp_users.
initialize_driver ( )
maybeCheckTermExistsInDatabase ( integer $term_id ) : void Conditionally checks that a term exists in the database.
maybeSerialize ( $value ) : string
replaceNumbersInArray ( $entry, $i )
replaceNumbersInString ( $value, $i ) : mixed
setTemplateData ( array $overrides = [] )

Private Methods

Méthode Description
importSqlDumpFile ( )
increaseTermCountBy ( $termTaxonomyId, $by = 1 )
maybeUnserialize ( $value )
prepareSqlDumpFile ( )

Method Details

_cleanup() public méthode

public _cleanup ( )

_initialize() public méthode

Initializes the module.
public _initialize ( Handlebars\Handlebars $handlebars = null, tad\WPBrowser\Generators\Tables $table = null )
$handlebars Handlebars\Handlebars
$table tad\WPBrowser\Generators\Tables

_seeTableInDatabase() protected méthode

protected _seeTableInDatabase ( $table ) : integer
$table
Résultat integer

dontHaveBlogInDatabase() public méthode

Removes an entry from the blogs table.
public dontHaveBlogInDatabase ( array $criteria )
$criteria array An array of search criteria.

dontHaveCommentInDatabase() public méthode

Removes an entry from the comments table.
public dontHaveCommentInDatabase ( array $criteria )
$criteria array An array of search criteria.

dontHaveCommentMetaInDatabase() public méthode

Removes an entry from the commentmeta table.
public dontHaveCommentMetaInDatabase ( array $criteria )
$criteria array An array of search criteria.

dontHaveLinkInDatabase() public méthode

Removes a link from the database.
public dontHaveLinkInDatabase ( array $criteria )
$criteria array An array of search criteria.

dontHaveOptionInDatabase() public méthode

Removes an entry from the options table.
public dontHaveOptionInDatabase ( $key, null $value = null ) : integer
$key
$value null
Résultat integer The removed option `option_id`.

dontHavePostInDatabase() public méthode

Removes an entry from the posts table.
public dontHavePostInDatabase ( array $criteria )
$criteria array An array of search criteria.

dontHavePostMetaInDatabase() public méthode

Removes an entry from the postmeta table.
public dontHavePostMetaInDatabase ( array $criteria )
$criteria array An array of search criteria.

dontHaveSiteOptionInDatabase() public méthode

Removes a site option from the database.
public dontHaveSiteOptionInDatabase ( $key, null $value = null )
$key
$value null

dontHaveSiteTransientInDatabase() public méthode

Removes a site transient from the database.

dontHaveTermInDatabase() public méthode

Removes a term from the database.
public dontHaveTermInDatabase ( array $criteria )
$criteria array An array of search criteria.

dontHaveTermMetaInDatabase() public méthode

Removes a term meta from the database.
public dontHaveTermMetaInDatabase ( array $criteria )
$criteria array An array of search criteria.

dontHaveTermRelationshipInDatabase() public méthode

Removes an entry from the term_relationships table.
public dontHaveTermRelationshipInDatabase ( array $criteria )
$criteria array An array of search criteria.

dontHaveTermTaxonomyInDatabase() public méthode

Removes an entry from the term_taxonomy table.
public dontHaveTermTaxonomyInDatabase ( array $criteria )
$criteria array An array of search criteria.

dontHaveTransientInDatabase() public méthode

Removes a transient from the database.
public dontHaveTransientInDatabase ( $transient ) : integer
$transient
Résultat integer The removed option `option_id`.

dontHaveUserInDatabase() public méthode

Removes a user from the database.
public dontHaveUserInDatabase ( integer | string $userIdOrLogin )
$userIdOrLogin integer | string

dontHaveUserMetaInDatabase() public méthode

Removes an entry from the usermeta table.
public dontHaveUserMetaInDatabase ( array $criteria )
$criteria array An array of search criteria.

dontSeeBlogInDatabase() public méthode

Checks that a row is not present in the blogs table.
public dontSeeBlogInDatabase ( array $criteria )
$criteria array An array of search criteria.

dontSeeCommentInDatabase() public méthode

Will look up the "comments" table.
public dontSeeCommentInDatabase ( array $criteria ) : void
$criteria array
Résultat void

dontSeeCommentMetaInDatabase() public méthode

Will look up the "commentmeta" table.
public dontSeeCommentMetaInDatabase ( array $criteria ) : void
$criteria array
Résultat void

dontSeeLinkInDatabase() public méthode

Will look up the "links" table.
public dontSeeLinkInDatabase ( array $criteria )
$criteria array An array of search criteria.

dontSeeOptionInDatabase() public méthode

If the value is an object or an array then the serialized option will be checked for.
public dontSeeOptionInDatabase ( array $criteria )
$criteria array An array of search criteria.

dontSeePageInDatabase() public méthode

Checks that a page is not in the database.
public dontSeePageInDatabase ( array $criteria )
$criteria array An array of search criteria.

dontSeePostInDatabase() public méthode

Checks that a post is not in the database.
public dontSeePostInDatabase ( array $criteria )
$criteria array An array of search criteria.

dontSeePostMetaInDatabase() public méthode

If the meta value is an object or an array then the serialized version will be checked for.
public dontSeePostMetaInDatabase ( array $criteria )
$criteria array An array of search criteria.

dontSeeTermInDatabase() public méthode

Looks up both the terms table and the term_taxonomy tables.
public dontSeeTermInDatabase ( array $criteria )
$criteria array An array of criteria to search for the term, can be columns from the `terms` and the `term_taxonomy` tables.

dontSeeTermMetaInDatabase() public méthode

Checks that a term meta is not in the database.
public dontSeeTermMetaInDatabase ( array $criteria )
$criteria array An array of search criteria.

dontSeeTermTaxonomyInDatabase() public méthode

Will look up the prefixed term_taxonomy table, e.g. wp_term_taxonomy.
public dontSeeTermTaxonomyInDatabase ( array $criteria )
$criteria array An array of search criteria.

dontSeeUserInDatabase() public méthode

Checks that a user is not in the database.
public dontSeeUserInDatabase ( array $criteria )
$criteria array An array of search criteria.

dontSeeUserMetaInDatabase() public méthode

Check that a user meta value is not in the database.
public dontSeeUserMetaInDatabase ( array $criteria )
$criteria array An array of search criteria.

getSiteDomain() public méthode

Returns the site domain inferred from the url set in the config.
public getSiteDomain ( ) : string
Résultat string

getSiteSubfolder() protected méthode

protected getSiteSubfolder ( ) : string
Résultat string

getUsersTableName() protected méthode

Returns the users table name, e.g. wp_users.
protected getUsersTableName ( ) : string
Résultat string

grabAllFromDatabase() public méthode

Returns all entries matching a criteria from the database.
public grabAllFromDatabase ( string $table, string $column, array $criteria ) : array
$table string
$column string
$criteria array
Résultat array An array of results.

grabBlogVersionsTableName() public méthode

Gets the prefixed blog_versions table name.
public grabBlogVersionsTableName ( ) : string
Résultat string

grabBlogsTableName() public méthode

Gets the prefixed blogs table name.
public grabBlogsTableName ( ) : string
Résultat string

grabCommentmetaTableName() public méthode

E.g. wp_commentmeta.
public grabCommentmetaTableName ( ) : string
Résultat string

grabCommentsTableName() public méthode

Gets the comments table name.
public grabCommentsTableName ( ) : string
Résultat string The prefixed table name, e.g. `wp_comments`.

grabLatestEntryByFromDatabase() public méthode

Returns the id value of the last table entry.
public grabLatestEntryByFromDatabase ( string $tableName, string $idColumn = 'ID' ) : mixed
$tableName string
$idColumn string
Résultat mixed

grabLinksTableName() public méthode

E.g. wp_links.
public grabLinksTableName ( ) : string
Résultat string

grabOptionFromDatabase() public méthode

Gets an option from the database.
public grabOptionFromDatabase ( string $option_name ) : mixed | string
$option_name string
Résultat mixed | string

grabPostMetaTableName() public méthode

Returns the prefixed post meta table name.
public grabPostMetaTableName ( ) : string
Résultat string The prefixed `postmeta` table name, e.g. `wp_postmeta`.

grabPostsTableName() public méthode

Gets the posts table name.
public grabPostsTableName ( ) : string
Résultat string The prefixed table name, e.g. `wp_posts`

grabPrefixedTableNameFor() public méthode

If the table is not one to be prefixed (e.g. users) then the proper table name will be returned.
public grabPrefixedTableNameFor ( string $tableName = '' ) : string
$tableName string The table name, e.g. `options`.
Résultat string The prefixed table name, e.g. `wp_options` or `wp_2_options`.

grabRegistrationLogTableName() public méthode

Gets the prefixed registration_log table name.
public grabRegistrationLogTableName ( ) : string
Résultat string

grabSignupsTableName() public méthode

Gets the prefixed signups table name.
public grabSignupsTableName ( ) : string
Résultat string

grabSiteMetaTableName() public méthode

Gets the prefixed sitemeta table name.
public grabSiteMetaTableName ( ) : string
Résultat string

grabSiteOptionFromDatabase() public méthode

Gets a site option from the database.
public grabSiteOptionFromDatabase ( string $key ) : mixed | string
$key string
Résultat mixed | string

grabSiteTableName() public méthode

Gets the prefixed site table name.
public grabSiteTableName ( ) : string
Résultat string

grabSiteTransientFromDatabase() public méthode

Gets a site transient from the database.
public grabSiteTransientFromDatabase ( string $key ) : mixed | string
$key string
Résultat mixed | string

grabSiteUrl() public méthode

Returns the current site url as specified in the module configuration.
public grabSiteUrl ( ) : string
Résultat string The current site URL

grabTablePrefix() public méthode

Returns the table prefix, namespaced for secondary blogs if selected.
public grabTablePrefix ( ) : string
Résultat string The blog aware table prefix.

grabTermIdFromDatabase() public méthode

Looks up the prefixed terms table, e.g. wp_terms.
public grabTermIdFromDatabase ( array $criteria )
$criteria array An array of search criteria.

grabTermMetaTableName() public méthode

E.g.: wp_termmeta.
public grabTermMetaTableName ( ) : string
Résultat string

grabTermRelationshipsTableName() public méthode

Gets the prefixed term relationships table name, e.g. wp_term_relationships.

grabTermTaxonomyIdFromDatabase() public méthode

Looks up the prefixed terms_relationships table, e.g. wp_term_relationships.
public grabTermTaxonomyIdFromDatabase ( array $criteria )
$criteria array An array of search criteria.

grabTermTaxonomyTableName() public méthode

Gets the prefixed term and taxonomy table name, e.g. wp_term_taxonomy.
public grabTermTaxonomyTableName ( ) : string
Résultat string

grabTermsTableName() public méthode

Gets the prefixed terms table name, e.g. wp_terms.
public grabTermsTableName ( ) : string
Résultat string

grabUserIdFromDatabase() public méthode

Gets the a user ID from the database using the user login.
public grabUserIdFromDatabase ( string $userLogin ) : integer
$userLogin string
Résultat integer The user ID

grabUserMetaFromDatabase() public méthode

Gets a user meta from the database.
public grabUserMetaFromDatabase ( integer $userId, string $meta_key ) : array
$userId integer
$meta_key string
Résultat array An associative array of meta key/values.

grabUsermetaTableName() public méthode

Returns the prefixed usermeta table name, e.g. wp_usermeta.
public grabUsermetaTableName ( ) : string
Résultat string

haveBlogInDatabase() public méthode

Inserts a blog in the blogs table.
public haveBlogInDatabase ( string $domainOrPath, array $overrides = [] ) : integer
$domainOrPath string The subdomain or the path to the be used for the blog.
$overrides array An array of values to override the defaults.
Résultat integer The inserted blog `blog_id`.

haveCommentInDatabase() public méthode

Inserts a comment in the database.
public haveCommentInDatabase ( integer $comment_post_ID, array $data = [] ) : integer
$comment_post_ID integer The id of the post the comment refers to.
$data array The comment data overriding default and random generated values.
Résultat integer The inserted comment `comment_id`

haveCommentMetaInDatabase() public méthode

Array and object meta values will be serialized.
public haveCommentMetaInDatabase ( integer $comment_id, string $meta_key, mixed $meta_value ) : integer
$comment_id integer
$meta_key string
$meta_value mixed
Résultat integer The inserted comment meta ID

haveLinkInDatabase() public méthode

Inserts a link in the database.
public haveLinkInDatabase ( array $overrides = [] ) : integer
$overrides array The data to insert.
Résultat integer The inserted link `link_id`.

haveManyBlogsInDatabase() public méthode

Inserts many blogs in the database.
public haveManyBlogsInDatabase ( integer $count, array $overrides = [] ) : array
$count integer
$overrides array
Résultat array An array of inserted blogs `blog_id`s.

haveManyCommentsInDatabase() public méthode

Inserts many comments in the database.
public haveManyCommentsInDatabase ( integer $count, integer $comment_post_ID, array $overrides = [] ) : int[]
$count integer The number of comments to insert.
$comment_post_ID integer The comment parent post ID.
$overrides array An associative array to override the defaults.
Résultat int[] An array containing the inserted comments IDs.

haveManyLinksInDatabase() public méthode

Inserts many links in the database.
public haveManyLinksInDatabase ( integer $count, array $overrides = [] ) : array
$count integer
$overrides array
Résultat array An array of inserted `link_id`s.

haveManyPostsInDatabase() public méthode

Inserts many posts in the database returning their IDs.
public haveManyPostsInDatabase ( integer $count, array $overrides = [] ) : array
$count integer The number of posts to insert.
$overrides array { An array of values to override the defaults. The `{{n}}` placeholder can be used to have the post count inserted in its place; e.g. `Post Title - {{n}}` will be set to `Post Title - 0` for the first post, `Post Title - 1` for the second one and so on. The same applies to meta values as well.
Résultat array

haveManyTermsInDatabase() public méthode

Inserts many terms in the database.
public haveManyTermsInDatabase ( integer $count, string $name, string $taxonomy, array $overrides = [] ) : array
$count integer
$name string The term name.
$taxonomy string The taxonomy name.
$overrides array An associative array of default overrides.
Résultat array An array of inserted terms `term_id`s.

haveManyUsersInDatabase() public méthode

public haveManyUsersInDatabase ( $count, $user_login, $role = 'subscriber', array $overrides = [] )
$overrides array

haveMenuInDatabase() public méthode

Creates and adds a menu to a theme location in the database.
public haveMenuInDatabase ( string $slug, string $location, array $overrides = [] ) : array
$slug string The menu slug.
$location string The theme menu location the menu will be assigned to.
$overrides array An array of values to override the defaults.
Résultat array An array containing the created menu `term_id` and `term_taxonomy_id`.

haveMenuItemInDatabase() public méthode

Adds a menu element to a menu for the current theme.
public haveMenuItemInDatabase ( string $menuSlug, string $title, integer | null $menuOrder = null, array $meta = [] ) : integer
$menuSlug string The menu slug the item should be added to.
$title string The menu item title.
$menuOrder integer | null An optional menu order, `1` based.
$meta array An associative array that will be prefixed with `_menu_item_` for the item post meta.
Résultat integer The menu item post `ID`

haveOptionInDatabase() public méthode

If the option value is an object or an array then the value will be serialized.
public haveOptionInDatabase ( string $option_name, mixed $option_value, string $autoload = 'yes' ) : integer
$option_name string
$option_value mixed
$autoload string
Résultat integer The inserted `option_id`

havePageInDatabase() public méthode

Inserts a page in the database.
public havePageInDatabase ( array $overrides = [] )
$overrides array An array of values to override the default ones.

havePostInDatabase() public méthode

Inserts a post in the database.
public havePostInDatabase ( array $data = [] ) : integer
$data array An associative array of post data to override default and random generated values.
Résultat integer post_id The inserted post ID.

havePostmetaInDatabase() public méthode

Adds one or more meta key and value couples in the database for a post.
public havePostmetaInDatabase ( integer $post_id, string $meta_key, mixed $meta_value ) : integer
$post_id integer
$meta_key string
$meta_value mixed The value to insert in the database, objects and arrays will be serialized.
Résultat integer The inserted meta `meta_id`.

haveSiteOptionInDatabase() public méthode

If the value is an array or an object then the value will be serialized.
public haveSiteOptionInDatabase ( string $key, mixed $value ) : integer
$key string
$value mixed
Résultat integer The inserted option `option_id`.

haveSiteTransientInDatabase() public méthode

If the value is an array or an object then the value will be serialized.
public haveSiteTransientInDatabase ( $key, $value )
$key
$value

haveTermInDatabase() public méthode

Inserts a term in the database.
public haveTermInDatabase ( string $name, string $taxonomy, array $overrides = [] ) : array
$name string The term name, e.g. "Fuzzy".
$taxonomy string The term taxonomy
$overrides array An array of values to override the default ones.
Résultat array An array containing `term_id` and `term_taxonomy_id` of the inserted term.

haveTermMetaInDatabase() public méthode

Objects and array meta values will be serialized.
public haveTermMetaInDatabase ( integer $term_id, string $meta_key, mixed $meta_value ) : integer
$term_id integer
$meta_key string
$meta_value mixed
Résultat integer The inserted term meta `meta_id`

haveTermRelationshipInDatabase() public méthode

Please mind that no check about the consistency of the insertion is made. E.g. a post could be assigned a term from a taxonomy that's not registered for that post type.
public haveTermRelationshipInDatabase ( integer $object_id, integer $term_taxonomy_id, integer $term_order )
$object_id integer A post ID, a user ID or anything that can be assigned a taxonomy term.
$term_taxonomy_id integer
$term_order integer Defaults to `0`.

haveTransientInDatabase() public méthode

If the value is an array or an object then the value will be serialized.
public haveTransientInDatabase ( string $transient, mixed $value ) : integer
$transient string
$value mixed
Résultat integer The inserted option `option_id`.

haveUserCapabilitiesInDatabase() public méthode

Sets a user capabilities.
public haveUserCapabilitiesInDatabase ( integer $userId, string | array $role ) : array
$userId integer
$role string | array Either a role string (e.g. `administrator`) or an associative array of blog IDs/roles for a multisite installation; e.g. `[1 => 'administrator`, 2 => 'subscriber']`.
Résultat array An array of inserted `meta_id`.

haveUserInDatabase() public méthode

Inserts a user and appropriate meta in the database.
public haveUserInDatabase ( string $user_login, string $role = 'subscriber', array $overrides = [] ) : integer
$user_login string The user login slug
$role string The user role slug, e.g. "administrator"; defaults to "subscriber".
$overrides array An associative array of column names and values overridind defaults in the "users" and "usermeta" table.
Résultat integer The inserted user `ID`

haveUserLevelsInDatabase() public méthode

Sets the user level in the database for a user.
public haveUserLevelsInDatabase ( integer $userId, string | array $role ) : array
$userId integer
$role string | array Either a role string (e.g. `administrator`) or an array of blog IDs/roles for a multisite installation.
Résultat array An array of inserted `meta_id`.

haveUserMetaInDatabase() public méthode

Sets a user meta.
public haveUserMetaInDatabase ( integer $userId, string $meta_key, mixed $meta_value ) : array
$userId integer
$meta_key string
$meta_value mixed Either a single value or an array of values; objects will be serialized while array of values will trigger the insertion of multiple rows.
Résultat array An array of inserted `user_id`.

initialize_driver() protected méthode

protected initialize_driver ( )

maybeCheckTermExistsInDatabase() protected méthode

Will look up the "terms" table, will throw if not found.
protected maybeCheckTermExistsInDatabase ( integer $term_id ) : void
$term_id integer The term ID.
Résultat void

maybeSerialize() protected méthode

protected maybeSerialize ( $value ) : string
$value
Résultat string

replaceNumbersInArray() protected méthode

protected replaceNumbersInArray ( $entry, $i )

replaceNumbersInString() protected méthode

protected replaceNumbersInString ( $value, $i ) : mixed
$value
$i
Résultat mixed

replaceSiteDomainInMultisiteSql() public méthode

replaceSiteDomainInSql() public méthode

Replaces the WordPress domains in a SQL dump string.
public replaceSiteDomainInSql ( string $sql ) : string
$sql string The input SQL dump string.
Résultat string The modified SQL string.

seeBlogInDatabase() public méthode

Checks for a blog in the database, looks up the blogs table.
public seeBlogInDatabase ( array $criteria )
$criteria array An array of search criteria.

seeCommentInDatabase() public méthode

Will look up the "comments" table.
public seeCommentInDatabase ( array $criteria ) : void
$criteria array
Résultat void

seeCommentMetaInDatabase() public méthode

Will look up the "commentmeta" table.
public seeCommentMetaInDatabase ( array $criteria ) : void
$criteria array
Résultat void

seeLinkInDatabase() public méthode

Will look up the "links" table.
public seeLinkInDatabase ( array $criteria )
$criteria array An array of search criteria.

seeOptionInDatabase() public méthode

If checking for an array or an object then the serialized version will be checked for.
public seeOptionInDatabase ( array $criteria )
$criteria array An array of search criteria.

seePageInDatabase() public méthode

Checks for a page in the database.
public seePageInDatabase ( array $criteria )
$criteria array An array of search criteria.

seePostInDatabase() public méthode

Checks for a post in the database.
public seePostInDatabase ( array $criteria )
$criteria array An array of search criteria.

seePostMetaInDatabase() public méthode

If the meta_value is an object or an array then the serialized value will be checked for.
public seePostMetaInDatabase ( array $criteria )
$criteria array An array of search criteria.

seePostWithTermInDatabase() public méthode

Will look up the "term_relationships" table.
public seePostWithTermInDatabase ( integer $post_id, integer $term_id, integer $term_order ) : void
$post_id integer The post ID.
$term_id integer The term ID.
$term_order integer The order the term applies to the post, defaults to 0.
Résultat void

seeSiteOptionInDatabase() public méthode

Checks that a site option is in the database.
public seeSiteOptionInDatabase ( string $key, mixed | null $value = null )
$key string
$value mixed | null

seeSiteSiteTransientInDatabase() public méthode

Checks that a site option is in the database.
public seeSiteSiteTransientInDatabase ( string $key, mixed | null $value = null )
$key string
$value mixed | null

seeTableInDatabase() public méthode

Checks for a table in the database.
public seeTableInDatabase ( string $table )
$table string

seeTermInDatabase() public méthode

Looks up the terms and term_taxonomy prefixed tables.
public seeTermInDatabase ( array $criteria )
$criteria array An array of criteria to search for the term, can be columns from the `terms` and the `term_taxonomy` tables.

seeTermMetaInDatabase() public méthode

Checks for a term meta in the database.
public seeTermMetaInDatabase ( array $criteria )
$criteria array An array of search criteria.

seeTermRelationshipInDatabase() public méthode

Checks for a term relationship in the database.
public seeTermRelationshipInDatabase ( array $criteria )
$criteria array An array of search criteria.

seeTermTaxonomyInDatabase() public méthode

Will look up the prefixed term_taxonomy table, e.g. wp_term_taxonomy.
public seeTermTaxonomyInDatabase ( array $criteria )
$criteria array An array of search criteria.

seeUserInDatabase() public méthode

Will look up the "users" table.
public seeUserInDatabase ( array $criteria ) : void
$criteria array
Résultat void

seeUserMetaInDatabase() public méthode

Checks for a user meta value in the database.
public seeUserMetaInDatabase ( array $criteria )
$criteria array An array of search criteria.

setTemplateData() protected méthode

protected setTemplateData ( array $overrides = [] )
$overrides array

useBlog() public méthode

Sets the blog to be used.
public useBlog ( integer $id )
$id integer

useMainBlog() public méthode

Sets the current blog to the main one (blog_id 1).
public useMainBlog ( )

useTheme() public méthode

Sets the current theme options.
public useTheme ( string $stylesheet, string | null $template = null, string | null $themeName = null )
$stylesheet string The theme stylesheet slug, e.g. `twentysixteen`.
$template string | null The theme template slug, e.g. `twentysixteen`, defaults to `$stylesheet`.
$themeName string | null The theme name, e.g. `Twentysixteen`, defaults to title version of `$stylesheet`.

Property Details

$blogId protected_oe property

The id of the blog currently used.
protected $blogId

$config protected_oe property

The module optional configuration parameters.
protected array $config
Résultat array

$handlebars protected_oe property

protected Handlebars,Handlebars $handlebars
Résultat Handlebars\Handlebars

$isSubdomainMultisiteInstall protected_oe property

protected bool $isSubdomainMultisiteInstall
Résultat boolean

$menuItems protected_oe property

protected array $menuItems
Résultat array

$menus protected_oe property

protected array $menus
Résultat array

$numberPlaceholder protected_oe property

protected string $numberPlaceholder
Résultat string

$requiredFields protected_oe property

url - the site url
protected array $requiredFields
Résultat array

$stylesheet protected_oe property

The theme stylesheet in use.
protected $stylesheet

$tablePrefix protected_oe property

The table prefix to use.
protected string $tablePrefix
Résultat string

$tables protected_oe property

protected Tables,tad\WPBrowser\Generators $tables
Résultat tad\WPBrowser\Generators\Tables

$templateData protected_oe property

protected array $templateData
Résultat array

$termKeys protected_oe property

protected array $termKeys
Résultat array

$termTaxonomyKeys protected_oe property

protected array $termTaxonomyKeys
Résultat array

$uniqueTables protected_oe property

A list of tables that WordPress will nor replicate in multisite installations.
protected $uniqueTables