/** * @expectedException \InvalidArgumentException */ public function testValueValidatorException() { $p = new Parameter('test'); $this->assertEquals(null, $p->getValue()); $p->setValue('test'); $this->assertEquals('test', $p->getValue()); $validatorMock = $this->getMock('\\hergot\\databroker\\DataAdapter\\ValidatorInterface'); $validatorMock->expects($this->once())->method('isValid')->will($this->returnCallback(function ($value) { $this->assertEquals('test', $value); return false; })); $p->setValidator($validatorMock); $p->setValue('test'); }
public function testToArray() { $p = new Parameter('test'); $p2 = new Parameter('test2'); $p2->setValue('test'); $pc = new ParameterCollection(); $pc->addParameter($p); $pc->addParameter($p2); $this->assertEquals(array('test' => null, 'test2' => 'test'), $pc->toArray()); }