/** * Tests if correct urls are collected. * * @param string $repository * @param string[] $expectedUrls * @param int|null $language * * @dataProvider urlsTestProvider */ public function testUrls($repository, $expectedUrls, $language) { $repository = $this->getEntityManager()->getRepository($repository); /** @var Category|Article|Content $entity */ foreach ($repository->findAll() as $entity) { $seos = $this->seoFinder->getEntitySeo($entity, $language); $urls = []; foreach ($seos as $seo) { $urls[] = $seo->getSeoUrl(); } sort($urls); sort($expectedUrls[$entity->getId()]); $this->assertSame($expectedUrls[$entity->getId()], $urls); } }
/** * Tests if exception is thrown on invalid argument. */ public function testException() { $instance = new SeoFinder(); $this->setExpectedException('InvalidArgumentException'); $instance->getEntitySeo(new \stdClass()); }