コード例 #1
0
 /** @test */
 public function it_should_throw_an_exception_while_adding_a_scoped_page_to_a_non_scoped_page()
 {
     $this->setExpectedException(\Baum\MoveNotPossibleException::class);
     $root = ScopedPage::create([]);
     $root->slugs()->create(['lang_code' => $this->lang, 'name' => 'generic root page']);
     $child = $root->children()->create(['type' => 'generic']);
 }
コード例 #2
0
 /** @test */
 public function it_should_throw_an_exception_while_making_a_page_root_if_another_root_is_present()
 {
     $this->setExpectedException(\Baum\MoveNotPossibleException::class);
     $scoped_root = ScopedPage::create(['type' => 'generic']);
     $scoped_root->slugs()->create(['lang_code' => $this->lang, 'name' => 'root page']);
     $child = $scoped_root->children()->create(['type' => 'generic']);
     $child->slugs()->create(['lang_code' => $this->lang, 'name' => 'root page']);
     $child->makeRoot();
 }
コード例 #3
0
 /** @test */
 public function it_should_throw_an_exception_if_the_page_corresponding_to_the_url_does_not_exists_for_the_scoped_attribute()
 {
     $this->setExpectedException(\Illuminate\Database\Eloquent\ModelNotFoundException::class);
     $root = ScopedPage::create();
     $root->slugs()->create(['lang_code' => $this->lang, 'name' => 'root page']);
     $child = $root->children()->create([]);
     $child->slugs()->create(['lang_code' => $this->lang, 'name' => 'child page']);
     $page = ScopedPage::match('/root-page/child-page', $this->lang, ['type' => 'generic']);
 }