Example #1
0
 public function testSlugAccessors()
 {
     $emptySlug = new Slug();
     $emptySlug->setUrl('/');
     $page = new Page();
     $this->assertEquals([$emptySlug], $page->getSlugs()->toArray());
     $firstSlug = new Slug();
     $secondSlug = new Slug();
     $page->addSlug($firstSlug)->addSlug($secondSlug);
     $this->assertEquals([$emptySlug, $firstSlug, $secondSlug], array_values($page->getSlugs()->toArray()));
     $page->removeSlug($firstSlug)->removeSlug($firstSlug);
     $this->assertEquals([$emptySlug, $secondSlug], array_values($page->getSlugs()->toArray()));
 }