/** * @covers Desk\Command\PreValidator::castPrimitivesToArrays * @dataProvider dataCastPrimitivesToArrays * * @param array $param Parameter description/structure * @param mixed $value Input value for the parameter * @param mixed $expected Expected output value */ public function testCastPrimitivesToArrays(array $param, $value, $expected) { $command = new OperationCommand(array('foo' => $value), new Operation(array('parameters' => array('foo' => $param)))); $command->setClient(new Client()); $event = new Event(array('command' => $command)); $preValidator = $this->mock('castPrimitivesToArrays'); $preValidator->castPrimitivesToArrays($event); $this->assertSame($expected, $command->get('foo')); }
public function testForceSet() { $plugin = new DataSetter(array('test_key' => 'test_value'), true); $command = new OperationCommand(); $command->set('test_key', 'already_stated_value'); $event = new Event(array('command' => $command)); $plugin->register($this->client); $this->client->getEventDispatcher()->dispatch('command.before_prepare', $event); $this->assertSame('test_value', $command->get('test_key')); }