|
@@ 53-65 (lines=13) @@
|
| 50 |
|
$this->user = new TestUser(); |
| 51 |
|
} |
| 52 |
|
|
| 53 |
|
public function testViolationsOnDuplicateUserProperty() |
| 54 |
|
{ |
| 55 |
|
$this->ldapManagerMock->expects($this->once()) |
| 56 |
|
->method('findUserByUsername') |
| 57 |
|
->will($this->returnValue($this->user)) |
| 58 |
|
->with($this->equalTo($this->user->getUsername())); |
| 59 |
|
|
| 60 |
|
$this->validatorContext->expects($this->once()) |
| 61 |
|
->method('addViolation') |
| 62 |
|
->with('User already exists.'); |
| 63 |
|
|
| 64 |
|
$this->validator->validate($this->user, $this->constraint); |
| 65 |
|
} |
| 66 |
|
|
| 67 |
|
public function testNoViolationsOnUniqueUserProperty() |
| 68 |
|
{ |
|
@@ 67-78 (lines=12) @@
|
| 64 |
|
$this->validator->validate($this->user, $this->constraint); |
| 65 |
|
} |
| 66 |
|
|
| 67 |
|
public function testNoViolationsOnUniqueUserProperty() |
| 68 |
|
{ |
| 69 |
|
$this->ldapManagerMock->expects($this->once()) |
| 70 |
|
->method('findUserByUsername') |
| 71 |
|
->will($this->returnValue(null)) |
| 72 |
|
->with($this->equalTo($this->user->getUsername())); |
| 73 |
|
|
| 74 |
|
$this->validatorContext->expects($this->never()) |
| 75 |
|
->method('addViolation'); |
| 76 |
|
|
| 77 |
|
$this->validator->validate($this->user, $this->constraint); |
| 78 |
|
} |
| 79 |
|
|
| 80 |
|
/** |
| 81 |
|
* @expectedException \Symfony\Component\Validator\Exception\UnexpectedTypeException |