/** * * @param \Bpi\ApiBundle\Domain\ValueObject\Yearwheel $yearwheel * @return \Bpi\ApiBundle\Domain\Factory\ProfileBuilder */ public function yearwheel(Yearwheel $yearwheel) { $repo = new YearwheelRepository(); if (!$repo->contains($yearwheel)) { throw new InvalidStateException('Incorrect yearwheel value'); } $this->yearwheel = $yearwheel; return $this; }
public function testFind() { // Easter $this->assertEquals('Easter', $this->repo->find('Easter')->name()); $easter = new Yearwheel('Easter'); $this->assertTrue($easter->equals($this->repo->find('Easter'))); // Christmas $this->assertEquals('Christmas', $this->repo->find('Christmas')->name()); // Summer $this->assertEquals('Summer', $this->repo->find('Summer')->name()); // Winter $this->assertEquals('Winter', $this->repo->find('Winter')->name()); $this->assertEquals(new Yearwheel('Winter'), $this->repo->find('Winter')); }
/** * @param \Bpi\ApiBundle\Domain\Repository\YearwheelRepository $repository * @return boolean */ public function isInRepository(YearwheelRepository $repository) { return $repository->findAll()->contains($this); }