Fork me on GitHub
Subscribe 2

Ticket #374 (fixed task)

Create test framework+cases for fluxbb-cache

  • Created: 2011-03-24 09:46:18
  • Reported by: Reines
  • Assigned to: Franz
  • Milestone: 2.0-alpha1
  • Component: testing
  • Priority: low

We should start using unit testing for the FluxBB modules where possible. Now that we are taking a more modular approach and using OOP this is easier than before.


Reines 2011-03-24 09:50:59

  • Component changed from caching to testing.

Reines 2011-04-06 10:23:40

  • Owner Reines removed.

Franz 2011-11-24 22:58:51

  • Owner set to Franz.

Franz 2012-02-16 00:19:43

Commit 2ae648e to cache master

#374: Test correct generation of statistics (inserts, hits, misses).

Franz 2012-02-16 00:25:09

So what else should be tested here?

Is it possible to test persistance?

Comment edited 1 times (Diff)

Franz 2012-02-21 13:20:09

Jamie, you said something about testing serializers in chat. What would that look like?

Reines 2012-02-21 17:40:14

Just something to test that an object matches the original after encoding and decoding, for the Serialize, JSON, VarExport, XML, and YAML serializers.

i.e. something like the following, passing it each serializer, and a combination of strings, ints, objects, etc.

function test($value, $serializer) {
    $encoded = $serializer->encode($value);
    $decoded = $serializer->decode($value);

    // TODO: assert $encoded is a string
    // TODO: assert $value and $decoded are equal

This could be extended to test all the filters actually, though obviously the is string assertion is only valid for serializers.

Comment edited 1 times (Diff)

Franz 2012-05-23 22:46:06

Et voila, I implemented the serializer tests in cache/618e64e.

They mostly work, except for the array one for JSON and objects for all of them (should that even be supported?).

Franz 2012-05-24 08:10:13

The tests are basically complete now, but there are a few errors and failures.

Could you please checkout the failures? They're mostly BCrypt-related and I'm not quite sure what to do about them... maybe it's because the data is base-64-encoded (wild guess)!?

Comment edited 1 times (Diff)

Franz 2012-06-18 12:36:01

Ah, I found out from this article that serializing data first works great for arrays and MCrypt. Let's see if this trick works for other algorithms, too. smile

Franz 2012-06-18 23:17:27

Tests are passing now, woot woot!

Only thing remaining: I'll have one more attempt to get the currently skipped tests to work. Especially the XML serializer one.

Franz 2012-06-19 13:03:55

Meh. Tests for the XML serializer are failing. The reason is pretty much that PEAR's XML_Serializer isn't compatible with PHP 5.3 (in this case, there are issues with static function calls even though the functions aren't static).

What should we do about this?
I don't really want to create a new PEAR package for PEAR2/Pyrus/PHP5.3 (although I kinda want to).

Franz 2012-06-19 14:39:31

  • Status changed from open to fixed.

Ok, I'll mark this as closed now and created another ticket for the XML serializer because that just stops me from progressing right now, but at the same time isn't very important.