/** * @expectedException \RuntimeException * @expectedExceptionMessage No detector is configured for this namer. */ public function testNoDetector() { $name = 'Namer'; $strategy = $this->getMockStrategy(); $strategy->expects($this->never())->method('getName'); $namer = new Namer($strategy); $namer->getName($name); // Will throw an exception with no detector configured. }
/** * @param Namer $namer */ public function addNamer(Namer $namer) { $this->namers[$namer->getName()] = $namer; }