/** * {@inheritDoc} */ public function registerSubject($id, SubjectInterface $subject) { if (isset($this->subjects[$id])) { throw CollectionException::idUsed($id); } $this->subjects[$id] = $subject; }
/** * Make sure we get the message we are expecting. */ public function testIdUsed() { $this->assertEquals('The "test" subject unique identifier is already in use.', CollectionException::idUsed('test')->getMessage(), 'Make sure we get the right message.'); }