[HttpKernel] RedisProfilerStorage - Fix falling unit tests when Redis extension is not available #4164

Merged
merged 1 commit into from Apr 30, 2012

Conversation

Projects
None yet
3 participants
Contributor

pulzarraider commented Apr 30, 2012

Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: -
Todo: -

Fix error of my PR #4150

Unit tests were falling if Redis extension was not available. It was caused by using Redis constants.

@fabpot fabpot added a commit that referenced this pull request Apr 30, 2012

@fabpot fabpot merged branch pulzarraider/redis_const_profiler_fix (PR #4164)
Commits
-------

991474b [HttpKernel] RedisProfilerStorage - Fix falling unit tests when Redis extension is not available

Discussion
----------

[HttpKernel] RedisProfilerStorage - Fix falling unit tests when Redis extension is not available

Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: -
Todo: -

Fix error of my PR #4150

Unit tests were falling if Redis extension was not available. It was caused by using Redis constants.
cbf16fe

@fabpot fabpot merged commit 991474b into symfony:master Apr 30, 2012

Member

jakzal commented Apr 30, 2012

Wouldn't it be better to disable the tests if extension is not present (since the class cannot be used in such environment anyway)? This is how it's done in NativeRedisSessionHandler tests.

Contributor

pulzarraider commented Apr 30, 2012

NativeRedisSessionHandler is a bit different. Unfortunately, it will be very complicated to simulate its functionality without Redis extension.

But in ProfilerStorage is situation easier. Redis/Memcache(d) are used here only to store data with basic methods. This can be simulated with simple mock objects. I changed Redis/Memcache(d) storages this way to be testable without presence of these specific extensions. It makes testing faster (if you have those extensions) and it may help developers extending and changing ProfilerStorage in the future easier even if they don't have those extensions or no access to redis/memcache server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment