Commit Graph

6 Commits

Author SHA1 Message Date
Boone Gorges ec53bf5bf6 Add tests for `get_bookmarks()` cache.
This changeset adds a unit test factory so that bookmark/link fixtures can be
created during tests.

Why are we writing tests for functionality that has been deprecated for years?
Because it's the Right Thing to Do.

See #18356.

git-svn-id: https://develop.svn.wordpress.org/trunk@37563 602fd350-edb4-49c9-b593-d223f7449a82
2016-05-25 18:20:24 +00:00
Jeremy Felt 4429638da6 Tests: Set `public` to `1` in the default blog factory
When no `$meta` arguments are passed to `wpmu_create_blog()`, `public` is set to `0` in the database for new sites. This is fine, but also does not match the default implied when most sites are created via `site-new.php`.

The only current use of the `$meta` argument in the tests is to (re)mark `public` as `0`. All existing tests pass with this change. Tests for `WP_Site_Query` can now rely on better default expectations.

See #36566.


git-svn-id: https://develop.svn.wordpress.org/trunk@37418 602fd350-edb4-49c9-b593-d223f7449a82
2016-05-11 19:21:22 +00:00
Boone Gorges 7c79386135 Tests: Use the same incrementor for all fields belonging to a given text fixture.
[35244] changed the way that `WP_UnitTest_Generator_Sequence()` created an
incrementor for object fields (like 'post_name' and 'user_email'), by making
incrementor static across the entire run of the test suite. While this helped
to enforce uniqueness across the tests, it has the side effect of bumping the
incrementor between fields on the same object (so that, eg, the same post might
have `post_name` "post-12" but `post_title` "Post 13". By switching to a
technique that uses the same incrementor for each field belonging to a given
fixture, we conform better to the expectations of developers using
`WP_UnitTest_Factory`.

Fixes #35199.

git-svn-id: https://develop.svn.wordpress.org/trunk@37299 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-22 14:35:52 +00:00
ericlewis 59c8ba7871 Build/Test Tools: Document PHP unit test classes.
Props boonebgorges.
Fixes #35494.


git-svn-id: https://develop.svn.wordpress.org/trunk@36854 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-05 19:47:41 +00:00
Eric Andrew Lewis 8d562e0d04 Build/Test Tools: Move class `WP_UnitTest_Factory` into its own file.
In [36347] we moved all PHP factory classes into their own files except the main class. The main class is now in its own file, and `factory.php` is solely an include manifest for all factory classes.


git-svn-id: https://develop.svn.wordpress.org/trunk@36409 602fd350-edb4-49c9-b593-d223f7449a82
2016-01-27 03:26:15 +00:00
Eric Andrew Lewis d36d6cc630 Build/Test Tools: Move PHP factory classes into their own files.
This makes the code easier to browse.

`factory.php` loads the new files, so this is backwards compatible in case `factory.php` is loaded directly for access to one of the classes.

See #35492.


git-svn-id: https://develop.svn.wordpress.org/trunk@36347 602fd350-edb4-49c9-b593-d223f7449a82
2016-01-19 03:55:19 +00:00