Exemple #1
0
 public function testResult()
 {
     $result = new Result('foo', array('An error occured'));
     $this->assertEquals('foo', $result->getValue());
     $this->assertEquals('An error occured', $result->getFirstError());
     $result->setValue('bar');
     $result->setErrors(array('Another error'));
     $result->addError('More errors');
     $this->assertEquals('bar', $result->getValue());
     $this->assertEquals('Another error', $result->getFirstError());
     $this->assertFalse($result->isSuccessful());
     $this->assertTrue($result->hasError());
     $this->assertEquals('Another error, More errors', $result->__toString());
 }