joomla / joomla-framework

[READ-ONLY] This repo is no longer in active development. Please see https://github.com/joomla-framework for the individual Framework packages.
http://framework.joomla.org
GNU General Public License v2.0
189 stars 140 forks source link

Enable and fix basic Memcached unit testing on travis #330

Closed ghost closed 10 years ago

ghost commented 10 years ago

Enabled Memcached extension for travis - both session and cache Memcache engines were broken and would not even pass their own unit tests[what few there were] - but without the extension enabled the tests would not run.

Also modifies the following testing classes for Cache: CacheTest, MemcachedTest

CacheTest now uses static protected variable and late static binding on calls to implement over 90% of the unit tests[previously only 10% were not skipped] MemcachedTest now inherits from CacheTest and contains almost no unit tests of it's own[most of the tests from CacheTest are valid for it as well]. As with CacheTest, this brings method coverage up to 90% from 0%.

Modifies the following testing classes for Session: StorageTest, MemcachedTest Does the same thing for Session as was done for Cache.

Modifications to actual Joomla Framework classes: Joomla\Cache\Memcached constructor was modified:

Connect depends on $this->options['memcache.pool'] to be something[it can be false, but it has to be there]. This issue causes all other unit tests to fail. Modified constructor flow to 1) Check to see the Memcached extensions exists before anything else 2) Call the parent constructor second as it has common code needed for checking the $options argument 3) Lastly, before returning ensure that $this->options['memcache.pool'] exists and creates it if it does not.

Joomla\Session\Storage\Memcached constructor was modified:

register depends on $this->_servers in order to function. Parent class Joomla\Session\Storage::_construct() calls $this->register. But $this->_servers was not configured until afterward - thus this session storage class was not usable at all. Similiar changes were made in timing in order to get this class to work as were made to Joomla\Cache\Memcached

Note: this is the third time I've submitted these bug fixes.

ghost commented 10 years ago

Yes! Got rid of the code formatting errors[for my pulls] and got it running. Now it's getting just 3 failures - and those are for the unit tests that never worked to begin with... Gonna fix now

dongilbert commented 10 years ago

Awesome Gary!— Sent from Mailbox for iPhone

On Tue, Jan 14, 2014 at 6:14 PM, Gary A Mort notifications@github.com wrote:

Yes! Got rid of the code formatting errors[for my pulls] and got it running. Now it's getting just 3 failures - and those are for the unit tests that never worked to begin with... Gonna fix now

Reply to this email directly or view it on GitHub: https://github.com/joomla/joomla-framework/pull/330#issuecomment-32322492

ghost commented 10 years ago

Closed and resubmited as integrated commit in https://github.com/joomla/joomla-framework/pull/331