function it_should_throw_exception_when_adding_tape_with_duplicated_name(Tape $tape) { $this->beConstructedWith(__DIR__, $this->getConfigFile()); $tape->getName()->willReturn('my_tape'); $this->shouldThrow('Ikwattro\\GuzzleStereo\\Exception\\RecorderException')->duringAddTape($tape); }
/** * @param \Ikwattro\GuzzleStereo\Record\Tape $tape */ public function addTape(Tape $tape) { if (array_key_exists($tape->getName(), $this->tapes)) { throw new RecorderException(sprintf('A tape with name %s is already registered', $tape->getName())); } $this->tapes[$tape->getName()] = $tape; }