public function setCustomValues()
{
if (func_num_args() == 2) {
$this->customValues[func_get_arg(0)] = func_get_arg(1);
} else {
if (func_num_args() == 1 && is_array(func_get_arg(0))) {
foreach (func_get_arg(0) as $key => $value) {
$this->customValues[$key] = $value;
}
} else {
throw new Exception('Invalid number of custom values provided for the method "setCustomValues"');
}
}
return $this;
}
/** * @expectedException Exception */ public function testSetCustomValues() { $this->table->setCustomValues('foo', 'bar'); $this->assertArrayHasKey('foo', $this->table->getCustomValues()); $this->table->setCustomValues(array('foo2' => 'bar2', 'foo3' => 'bar3')); $this->assertArrayHasKey('foo2', $this->table->getCustomValues()); $this->assertArrayHasKey('foo3', $this->table->getCustomValues()); $this->table->setCustomValues('foo', 'bar', 'baz'); $this->assertTrue(False); // should throw exception before here }