Currently Browsing

Posts Tagged ‘ kohana ’

Setting up Kohana 3.2 unittest module

From 3.0 version Kohana has an official unittest module. There’s a great manual from Lysender how to configure it. But some things from this manual didn’t work for me so here’s the way how I’ve configured unittest module.

PHPUnit

First, you need PHPUnit 3.5 installed. It’s important. Not 3.6 (or even 3.7). If you’ve already PHPUnit 3.6 installed here’s a manual how to downgrade (for MacOSX, but for other systems it works in similar way).

Share

Arr::map doesn’t correctly work with multidimensional arrays whithin given $keys

I don’t know exactly whether this is a bug or a feature. But when I’m using Arr:map for multidimensional array like this

Array ( [user] => Array ( [add] => some ) [test] => test )

And when I want to apply some function with

$keys = array ('add')

, it has been applied to all items! I mean if some of key is located beneath the first layer it is ignored. This happens because of this line (SYSPATH/classes/kohana/arr.php, 372):

$array[$key] = Arr::map($callback, $array[$key]);

I think it should’ve been changed to

$array[$key] = Arr::map($callback, $array[$key], $keys);

Original post in kohana community.

Share