tollmanz / wordpress-pecl-memcached-object-cache

A WordPress object cache that uses the memcached (not memcache) PECL extension.
233 stars 114 forks source link

Test coverage #28

Closed danielbachhuber closed 10 years ago

danielbachhuber commented 10 years ago

I set up test coverage for the Redis drop-in here: https://github.com/alleyinteractive/wp-redis/pull/2

Should be pretty easy to port over should you want to.

tollmanz commented 10 years ago

@danielbachhuber I need to integrate tests that I already have (once I find them :( ). Interestingly, some of those test that you brought over from core were ones that I added to core based on ones that I wrote for this backend ;). I have really good coverage with my tests, but just need to dig them up. If I get them to you, would you want to set up CI?

tollmanz commented 10 years ago

Ugh...I was certain that I had these in a backup, but I cannot find them anywhere. I had SO many tests written and helped me find a ton of little bugs. This is very saddening :(

tollmanz commented 10 years ago

Woot! Found them in an email. I have 3000 lines of unit tests. These were written about a year and a half ago, so I am not sure how well they will play with the newer PHPUnit/WordPress setup. I'd love to integrate these tests if you are interested in helping.

tollmanz commented 10 years ago

I'd particularly love to get the "switch to blog" tests in here and get it covered for #23.

tollmanz commented 10 years ago

@danielbachhuber Can you review the "tests" branch and let me know what you think? I think this is setup correctly.

Is it possible to move all of the testing related stuff into a separate directory?

danielbachhuber commented 10 years ago

Can you review the "tests" branch and let me know what you think?

Looks pretty good but missing a couple of things for Travis. You'll want to make sure Memcache is running, and the PECL/memcached module active. In your .travis.yml this would be:

services:
    - memcache

before_script:
    - echo 'extension = "memcached.so"' >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini

Before you update and push, I'd get the repo set up with Travis so you can test the build for the first time.

Is it possible to move all of the testing related stuff into a separate directory?

I think you could just put it in a separate repo and submodule it in.

Interestingly, some of those test that you brought over from core were ones that I added to core based on ones that I wrote for this backend ;)

Heh. What I'd really like to do is extend the Test_Cache class in core unit tests to reduce duplicate code, ensure the drop-in is compatible with what core expects, and benefit from future updates to core tests. I think I might update WP-Redis' bootstrap script to download the test file so they can be used. How do you feel about that?

tollmanz commented 10 years ago

Looks pretty good but missing a couple of things for Travis.

Thanks, Daniel! I'll see if I can get this running.

I think you could just put it in a separate repo and submodule it in.

Good idea! I definitely want better organization than what I currently have.

Heh. What I'd really like to do is extend the Test_Cache class in core unit tests to reduce duplicate code, ensure the drop-in is compatible with what core expects, and benefit from future updates to core tests. I think I might update WP-Redis' bootstrap script to download the test file so they can be used. How do you feel about that?

I have mixed feelings about this. On the one hand, it would be nice to know that the core tests pass with this object cache; however, I find that the core tests need a lot of TLC. I wouldn't mind using them, but I like my tests a lot more. I had to get very granular with my tests in order to fully test the Memcached API. I would not want to lose any of that. I have no problem having both in there, but do not want to base this library's tests on core's tests.

Maybe it would be worth while porting my tests over to core ;)

tollmanz commented 10 years ago

Tests are integrated and Travis CI is setup with a passing status! Thanks for prompting me to do this @danielbachhuber!