Skip to content

Commit

Permalink
Test for "Additional data to be passed with callback"
Browse files Browse the repository at this point in the history
  • Loading branch information
zerkms authored and Woody Gilk committed Jul 11, 2010
1 parent e56e921 commit ef869b7
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion tests/kohana/ValidateTest.php
Expand Up @@ -863,11 +863,27 @@ public function test_check($array, $rules, $callbacks, $expected, $expected_erro
$this->assertSame($expected, $validate->check());
}

public function unit_test_callback(Validate $array, $field)
public function unit_test_callback(Validate $array, $field, $parameters = array())
{
return;
}

public function test_object_callback_with_parameters()
{
$params = array(42, 'kohana' => 'rocks');

$validate = Validate::factory(array('foo' => 'bar'));

$mock = $this->getMock(__CLASS__);
$mock->expects($this->once())
->method('unit_test_callback')
->with($this->equalTo($validate), $this->equalTo('foo'), $this->equalTo($params));

$validate->callback('foo', array($mock, 'unit_test_callback'), $params);

$validate->check();
}

/*public function provider_errors()
{
// [data, rules, expected], ...
Expand Down

0 comments on commit ef869b7

Please sign in to comment.