Conn lambda test
Updated Connection set/get unit test to accept objects
This commit is contained in:
parent
75afa73826
commit
160291a23f
@ -48,10 +48,24 @@ class ConnectionTest extends \PHPUnit_Framework_TestCase {
|
|||||||
$ret = $this->_c->faked;
|
$ret = $this->_c->faked;
|
||||||
}
|
}
|
||||||
|
|
||||||
// I think I'll be removing this feature from teh lib soon, so this UT will be removed when it fails
|
public static function lambdaProvider() {
|
||||||
public function testLambdaReturnValueOnGet() {
|
return array(
|
||||||
$this->_c->lambda = function() { return 'Hello World!'; };
|
array('hello', 'world')
|
||||||
$this->assertEquals('Hello World!', $this->_c->lambda);
|
, array('obj', new \stdClass)
|
||||||
|
, array('arr', array())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dataProvider lambdaProvider
|
||||||
|
*/
|
||||||
|
public function testLambdaReturnValueOnGet($key, $val) {
|
||||||
|
$fn = function() use ($val) {
|
||||||
|
return $val;
|
||||||
|
};
|
||||||
|
|
||||||
|
$this->_c->{$key} = $fn;
|
||||||
|
$this->assertSame($val, $this->_c->{$key});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user