Esempio n. 1
0
 /**
  * Check that a Group name is unique
  *
  * @param string $name
  * @throws ValueIsNotUniqueException
  * @return void
  */
 private function checkNameIsUnique($name)
 {
     $specification = new NameIsUnique($this->groups);
     if (!$specification->isSatisfiedBy($name)) {
         throw new ValueIsNotUniqueException("There is already a group called {$name}");
     }
 }
Esempio n. 2
0
 /** @test */
 public function should_return_false_when_not_unique()
 {
     $this->repository->shouldReceive('groupOfName')->andReturn(['id' => 1]);
     $this->assertFalse($this->spec->isSatisfiedBy('Cribbb'));
 }