PHP Класс Codeception\Module\WPDb

Наследование: extends ExtendedDb
Показать файл Открыть проект

Защищенные свойства (Protected)

Свойство Тип Описание
$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.

Открытые методы

Метод Описание
_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.

Защищенные методы

Метод Описание
_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 = [] )

Приватные методы

Метод Описание
importSqlDumpFile ( )
increaseTermCountBy ( $termTaxonomyId, $by = 1 )
maybeUnserialize ( $value )
prepareSqlDumpFile ( )

Описание методов

_cleanup() публичный Метод

public _cleanup ( )

_initialize() публичный Метод

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 _seeTableInDatabase ( $table ) : integer
$table
Результат integer

dontHaveBlogInDatabase() публичный Метод

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

dontHaveCommentInDatabase() публичный Метод

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

dontHaveCommentMetaInDatabase() публичный Метод

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

dontHaveLinkInDatabase() публичный Метод

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

dontHaveOptionInDatabase() публичный Метод

Removes an entry from the options table.
public dontHaveOptionInDatabase ( $key, null $value = null ) : integer
$key
$value null
Результат integer The removed option `option_id`.

dontHavePostInDatabase() публичный Метод

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

dontHavePostMetaInDatabase() публичный Метод

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

dontHaveSiteOptionInDatabase() публичный Метод

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

dontHaveSiteTransientInDatabase() публичный Метод

Removes a site transient from the database.

dontHaveTermInDatabase() публичный Метод

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

dontHaveTermMetaInDatabase() публичный Метод

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

dontHaveTermRelationshipInDatabase() публичный Метод

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

dontHaveTermTaxonomyInDatabase() публичный Метод

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

dontHaveTransientInDatabase() публичный Метод

Removes a transient from the database.
public dontHaveTransientInDatabase ( $transient ) : integer
$transient
Результат integer The removed option `option_id`.

dontHaveUserInDatabase() публичный Метод

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

dontHaveUserMetaInDatabase() публичный Метод

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

dontSeeBlogInDatabase() публичный Метод

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

dontSeeCommentInDatabase() публичный Метод

Will look up the "comments" table.
public dontSeeCommentInDatabase ( array $criteria ) : void
$criteria array
Результат void

dontSeeCommentMetaInDatabase() публичный Метод

Will look up the "commentmeta" table.
public dontSeeCommentMetaInDatabase ( array $criteria ) : void
$criteria array
Результат void

dontSeeLinkInDatabase() публичный Метод

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

dontSeeOptionInDatabase() публичный Метод

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() публичный Метод

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

dontSeePostInDatabase() публичный Метод

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

dontSeePostMetaInDatabase() публичный Метод

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() публичный Метод

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() публичный Метод

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

dontSeeTermTaxonomyInDatabase() публичный Метод

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() публичный Метод

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

dontSeeUserMetaInDatabase() публичный Метод

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

getSiteDomain() публичный Метод

Returns the site domain inferred from the url set in the config.
public getSiteDomain ( ) : string
Результат string

getSiteSubfolder() защищенный Метод

protected getSiteSubfolder ( ) : string
Результат string

getUsersTableName() защищенный Метод

Returns the users table name, e.g. wp_users.
protected getUsersTableName ( ) : string
Результат string

grabAllFromDatabase() публичный Метод

Returns all entries matching a criteria from the database.
public grabAllFromDatabase ( string $table, string $column, array $criteria ) : array
$table string
$column string
$criteria array
Результат array An array of results.

grabBlogVersionsTableName() публичный Метод

Gets the prefixed blog_versions table name.
public grabBlogVersionsTableName ( ) : string
Результат string

grabBlogsTableName() публичный Метод

Gets the prefixed blogs table name.
public grabBlogsTableName ( ) : string
Результат string

grabCommentmetaTableName() публичный Метод

E.g. wp_commentmeta.
public grabCommentmetaTableName ( ) : string
Результат string

grabCommentsTableName() публичный Метод

Gets the comments table name.
public grabCommentsTableName ( ) : string
Результат string The prefixed table name, e.g. `wp_comments`.

grabLatestEntryByFromDatabase() публичный Метод

Returns the id value of the last table entry.
public grabLatestEntryByFromDatabase ( string $tableName, string $idColumn = 'ID' ) : mixed
$tableName string
$idColumn string
Результат mixed

grabLinksTableName() публичный Метод

E.g. wp_links.
public grabLinksTableName ( ) : string
Результат string

grabOptionFromDatabase() публичный Метод

Gets an option from the database.
public grabOptionFromDatabase ( string $option_name ) : mixed | string
$option_name string
Результат mixed | string

grabPostMetaTableName() публичный Метод

Returns the prefixed post meta table name.
public grabPostMetaTableName ( ) : string
Результат string The prefixed `postmeta` table name, e.g. `wp_postmeta`.

grabPostsTableName() публичный Метод

Gets the posts table name.
public grabPostsTableName ( ) : string
Результат string The prefixed table name, e.g. `wp_posts`

grabPrefixedTableNameFor() публичный Метод

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`.
Результат string The prefixed table name, e.g. `wp_options` or `wp_2_options`.

grabRegistrationLogTableName() публичный Метод

Gets the prefixed registration_log table name.
public grabRegistrationLogTableName ( ) : string
Результат string

grabSignupsTableName() публичный Метод

Gets the prefixed signups table name.
public grabSignupsTableName ( ) : string
Результат string

grabSiteMetaTableName() публичный Метод

Gets the prefixed sitemeta table name.
public grabSiteMetaTableName ( ) : string
Результат string

grabSiteOptionFromDatabase() публичный Метод

Gets a site option from the database.
public grabSiteOptionFromDatabase ( string $key ) : mixed | string
$key string
Результат mixed | string

grabSiteTableName() публичный Метод

Gets the prefixed site table name.
public grabSiteTableName ( ) : string
Результат string

grabSiteTransientFromDatabase() публичный Метод

Gets a site transient from the database.
public grabSiteTransientFromDatabase ( string $key ) : mixed | string
$key string
Результат mixed | string

grabSiteUrl() публичный Метод

Returns the current site url as specified in the module configuration.
public grabSiteUrl ( ) : string
Результат string The current site URL

grabTablePrefix() публичный Метод

Returns the table prefix, namespaced for secondary blogs if selected.
public grabTablePrefix ( ) : string
Результат string The blog aware table prefix.

grabTermIdFromDatabase() публичный Метод

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

grabTermMetaTableName() публичный Метод

E.g.: wp_termmeta.
public grabTermMetaTableName ( ) : string
Результат string

grabTermRelationshipsTableName() публичный Метод

Gets the prefixed term relationships table name, e.g. wp_term_relationships.
public grabTermRelationshipsTableName ( ) : string
Результат string

grabTermTaxonomyIdFromDatabase() публичный Метод

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

grabTermTaxonomyTableName() публичный Метод

Gets the prefixed term and taxonomy table name, e.g. wp_term_taxonomy.
public grabTermTaxonomyTableName ( ) : string
Результат string

grabTermsTableName() публичный Метод

Gets the prefixed terms table name, e.g. wp_terms.
public grabTermsTableName ( ) : string
Результат string

grabUserIdFromDatabase() публичный Метод

Gets the a user ID from the database using the user login.
public grabUserIdFromDatabase ( string $userLogin ) : integer
$userLogin string
Результат integer The user ID

grabUserMetaFromDatabase() публичный Метод

Gets a user meta from the database.
public grabUserMetaFromDatabase ( integer $userId, string $meta_key ) : array
$userId integer
$meta_key string
Результат array An associative array of meta key/values.

grabUsermetaTableName() публичный Метод

Returns the prefixed usermeta table name, e.g. wp_usermeta.
public grabUsermetaTableName ( ) : string
Результат string

haveBlogInDatabase() публичный Метод

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.
Результат integer The inserted blog `blog_id`.

haveCommentInDatabase() публичный Метод

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.
Результат integer The inserted comment `comment_id`

haveCommentMetaInDatabase() публичный Метод

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
Результат integer The inserted comment meta ID

haveLinkInDatabase() публичный Метод

Inserts a link in the database.
public haveLinkInDatabase ( array $overrides = [] ) : integer
$overrides array The data to insert.
Результат integer The inserted link `link_id`.

haveManyBlogsInDatabase() публичный Метод

Inserts many blogs in the database.
public haveManyBlogsInDatabase ( integer $count, array $overrides = [] ) : array
$count integer
$overrides array
Результат array An array of inserted blogs `blog_id`s.

haveManyCommentsInDatabase() публичный Метод

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.
Результат int[] An array containing the inserted comments IDs.

haveManyLinksInDatabase() публичный Метод

Inserts many links in the database.
public haveManyLinksInDatabase ( integer $count, array $overrides = [] ) : array
$count integer
$overrides array
Результат array An array of inserted `link_id`s.

haveManyPostsInDatabase() публичный Метод

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.
Результат array

haveManyTermsInDatabase() публичный Метод

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.
Результат array An array of inserted terms `term_id`s.

haveManyUsersInDatabase() публичный Метод

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

haveMenuInDatabase() публичный Метод

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.
Результат array An array containing the created menu `term_id` and `term_taxonomy_id`.

haveMenuItemInDatabase() публичный Метод

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.
Результат integer The menu item post `ID`

haveOptionInDatabase() публичный Метод

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
Результат integer The inserted `option_id`

havePageInDatabase() публичный Метод

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

havePostInDatabase() публичный Метод

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.
Результат integer post_id The inserted post ID.

havePostmetaInDatabase() публичный Метод

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.
Результат integer The inserted meta `meta_id`.

haveSiteOptionInDatabase() публичный Метод

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
Результат integer The inserted option `option_id`.

haveSiteTransientInDatabase() публичный Метод

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

haveTermInDatabase() публичный Метод

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.
Результат array An array containing `term_id` and `term_taxonomy_id` of the inserted term.

haveTermMetaInDatabase() публичный Метод

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
Результат integer The inserted term meta `meta_id`

haveTermRelationshipInDatabase() публичный Метод

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() публичный Метод

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
Результат integer The inserted option `option_id`.

haveUserCapabilitiesInDatabase() публичный Метод

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']`.
Результат array An array of inserted `meta_id`.

haveUserInDatabase() публичный Метод

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.
Результат integer The inserted user `ID`

haveUserLevelsInDatabase() публичный Метод

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.
Результат array An array of inserted `meta_id`.

haveUserMetaInDatabase() публичный Метод

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.
Результат array An array of inserted `user_id`.

initialize_driver() защищенный Метод

protected initialize_driver ( )

maybeCheckTermExistsInDatabase() защищенный Метод

Will look up the "terms" table, will throw if not found.
protected maybeCheckTermExistsInDatabase ( integer $term_id ) : void
$term_id integer The term ID.
Результат void

maybeSerialize() защищенный Метод

protected maybeSerialize ( $value ) : string
$value
Результат string

replaceNumbersInArray() защищенный Метод

protected replaceNumbersInArray ( $entry, $i )

replaceNumbersInString() защищенный Метод

protected replaceNumbersInString ( $value, $i ) : mixed
$value
$i
Результат mixed

replaceSiteDomainInMultisiteSql() публичный Метод

replaceSiteDomainInSql() публичный Метод

Replaces the WordPress domains in a SQL dump string.
public replaceSiteDomainInSql ( string $sql ) : string
$sql string The input SQL dump string.
Результат string The modified SQL string.

seeBlogInDatabase() публичный Метод

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

seeCommentInDatabase() публичный Метод

Will look up the "comments" table.
public seeCommentInDatabase ( array $criteria ) : void
$criteria array
Результат void

seeCommentMetaInDatabase() публичный Метод

Will look up the "commentmeta" table.
public seeCommentMetaInDatabase ( array $criteria ) : void
$criteria array
Результат void

seeLinkInDatabase() публичный Метод

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

seeOptionInDatabase() публичный Метод

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() публичный Метод

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

seePostInDatabase() публичный Метод

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

seePostMetaInDatabase() публичный Метод

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() публичный Метод

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.
Результат void

seeSiteOptionInDatabase() публичный Метод

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

seeSiteSiteTransientInDatabase() публичный Метод

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

seeTableInDatabase() публичный Метод

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

seeTermInDatabase() публичный Метод

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() публичный Метод

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

seeTermRelationshipInDatabase() публичный Метод

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

seeTermTaxonomyInDatabase() публичный Метод

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() публичный Метод

Will look up the "users" table.
public seeUserInDatabase ( array $criteria ) : void
$criteria array
Результат void

seeUserMetaInDatabase() публичный Метод

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

setTemplateData() защищенный Метод

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

useBlog() публичный Метод

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

useMainBlog() публичный Метод

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

useTheme() публичный Метод

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`.

Описание свойств

$blogId защищенное свойство

The id of the blog currently used.
protected $blogId

$config защищенное свойство

The module optional configuration parameters.
protected array $config
Результат array

$handlebars защищенное свойство

protected Handlebars,Handlebars $handlebars
Результат Handlebars\Handlebars

$isSubdomainMultisiteInstall защищенное свойство

protected bool $isSubdomainMultisiteInstall
Результат boolean

$menuItems защищенное свойство

protected array $menuItems
Результат array

$menus защищенное свойство

protected array $menus
Результат array

$numberPlaceholder защищенное свойство

protected string $numberPlaceholder
Результат string

$requiredFields защищенное свойство

url - the site url
protected array $requiredFields
Результат array

$stylesheet защищенное свойство

The theme stylesheet in use.
protected $stylesheet

$tablePrefix защищенное свойство

The table prefix to use.
protected string $tablePrefix
Результат string

$tables защищенное свойство

protected Tables,tad\WPBrowser\Generators $tables
Результат tad\WPBrowser\Generators\Tables

$templateData защищенное свойство

protected array $templateData
Результат array

$termKeys защищенное свойство

protected array $termKeys
Результат array

$termTaxonomyKeys защищенное свойство

protected array $termTaxonomyKeys
Результат array

$uniqueTables защищенное свойство

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