[wp-trac] [WordPress Trac] #31491: Enhance unit tests for persistent object caching

WordPress Trac noreply at wordpress.org
Fri Aug 21 21:36:02 UTC 2015


#31491: Enhance unit tests for persistent object caching
------------------------------+-----------------------
 Reporter:  ocean90           |       Owner:  ocean90
     Type:  enhancement       |      Status:  assigned
 Priority:  normal            |   Milestone:  4.4
Component:  Build/Test Tools  |     Version:
 Severity:  normal            |  Resolution:
 Keywords:  needs-patch       |     Focuses:
------------------------------+-----------------------
Description changed by ocean90:

Old description:

> While running the tests with an object-cache.php drop-in (in this case
> [http://wordpress.org/extend/plugins/memcached/ Memcached]) I got some
> failing tests:
>
> {{{
> There were 6 failures:
>
> 1) Tests_Cache::test_wp_cache_init
> Failed asserting that two objects are equal.
> --- Expected
> +++ Actual
> @@ @@
>          'default' => Memcache Object (
> -            'connection' => resource(765) of type (memcache connection)
> +            'connection' => resource(764) of type (memcache connection)
>              '_failureCallback' => Array (...)
>          )
>      )
>      'stats' => Array (...)
>      'group_ops' => Array ()
>      'cache_enabled' => true
>      'default_expiration' => 0
>      'global_prefix' => 'wptests_'
>      'blog_prefix' => 'wptests_:'
>      'cache_hits' => null
>      'cache_misses' => null
>  )
>
> /srv/www/wp-develop/svn/tests/phpunit/tests/cache.php:284
>
> 2) Tests_Import_Import::test_small_import
> Failed asserting that 0 matches expected 6.
>
> /srv/www/wp-develop/svn/tests/phpunit/tests/import/import.php:175
>
> 3) Tests_Option_SiteTransient::test_the_basics
> Failed asserting that true is false.
>
> /srv/www/wp-develop/svn/tests/phpunit/tests/option/siteTransient.php:16
>
> 4) Tests_Option_Transient::test_the_basics
> Failed asserting that true is false.
>
> /srv/www/wp-develop/svn/tests/phpunit/tests/option/transient.php:16
>
> 5)
> Tests_Option_UpdateOption::test_should_set_autoload_yes_for_nonexistent_option_when_autoload_param_is_no
> Failed asserting that 42579 matches expected 42580.
>
> /srv/www/wp-develop/svn/tests/phpunit/tests/option/updateOption.php:88
>
> 6)
> Tests_Option_UpdateOption::test_should_set_autoload_yes_for_nonexistent_option_when_autoload_param_is_false
> Failed asserting that 42586 matches expected 42587.
>
> /srv/www/wp-develop/svn/tests/phpunit/tests/option/updateOption.php:113
>
> FAILURES!
> Tests: 3938, Assertions: 15029, Failures: 6, Errors: 1, Skipped: 16.
> }}}
>

> We should enhance these tests to make them work with a persistent object
> cache.
>
> From @pento: "It'd be worth having a memcache variant of our Travis
> tests.". Sounds like a good idea to me.

New description:

 While running the tests with an object-cache.php drop-in (in this case
 [http://wordpress.org/extend/plugins/memcached/ Memcached]) I got some
 failing tests:

 {{{
 There was 1 error:

 1) Tests_Cache::test_switch_to_blog
 Undefined variable: table_prefix

 /srv/www/wp-develop/svn/src/wp-content/object-cache.php:316
 /srv/www/wp-develop/svn/tests/phpunit/tests/cache.php:246

 --

 There were 6 failures:

 1) Tests_Cache::test_wp_cache_init
 Failed asserting that two objects are equal.
 --- Expected
 +++ Actual
 @@ @@
          'default' => Memcache Object (
 -            'connection' => resource(765) of type (memcache connection)
 +            'connection' => resource(764) of type (memcache connection)
              '_failureCallback' => Array (...)
          )
      )
      'stats' => Array (...)
      'group_ops' => Array ()
      'cache_enabled' => true
      'default_expiration' => 0
      'global_prefix' => 'wptests_'
      'blog_prefix' => 'wptests_:'
      'cache_hits' => null
      'cache_misses' => null
  )

 /srv/www/wp-develop/svn/tests/phpunit/tests/cache.php:284

 2) Tests_Import_Import::test_small_import
 Failed asserting that 0 matches expected 6.

 /srv/www/wp-develop/svn/tests/phpunit/tests/import/import.php:175

 3) Tests_Option_SiteTransient::test_the_basics
 Failed asserting that true is false.

 /srv/www/wp-develop/svn/tests/phpunit/tests/option/siteTransient.php:16

 4) Tests_Option_Transient::test_the_basics
 Failed asserting that true is false.

 /srv/www/wp-develop/svn/tests/phpunit/tests/option/transient.php:16

 5)
 Tests_Option_UpdateOption::test_should_set_autoload_yes_for_nonexistent_option_when_autoload_param_is_no
 Failed asserting that 42579 matches expected 42580.

 /srv/www/wp-develop/svn/tests/phpunit/tests/option/updateOption.php:88

 6)
 Tests_Option_UpdateOption::test_should_set_autoload_yes_for_nonexistent_option_when_autoload_param_is_false
 Failed asserting that 42586 matches expected 42587.

 /srv/www/wp-develop/svn/tests/phpunit/tests/option/updateOption.php:113

 FAILURES!
 Tests: 3938, Assertions: 15029, Failures: 6, Errors: 1, Skipped: 16.
 }}}


 We should enhance these tests to make them work with a persistent object
 cache.

 From @pento: "It'd be worth having a memcache variant of our Travis
 tests.". Sounds like a good idea to me.

--

--
Ticket URL: <https://core.trac.wordpress.org/ticket/31491#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list