コード例 #1
0
ファイル: DomainTest.php プロジェクト: sasin91/laravel-pages
 public function test_regular_pages_are_not_domained_pages()
 {
     Page::create(['title' => 'Yes a Page']);
     BlogPage::create(['title' => 'Not a Page']);
     $blogPages = BlogPage::all();
     $this->assertNotContains('Yes a Page', $blogPages->lists('title'));
 }
コード例 #2
0
ファイル: PageTest.php プロジェクト: sasin91/laravel-pages
 function test_page_publishing()
 {
     Page::create(['title' => 'Terra', 'public' => true]);
     Page::create(['title' => 'Locke', 'public_after' => $this->today('-1 day')]);
     Page::create(['title' => 'Edgar', 'public_before' => $this->today('+1 day')]);
     Page::create(['title' => 'Sabin', 'public_after' => $this->today('+1 day')]);
     $publishedPages = Page::published()->get();
     $slugs = $publishedPages->lists('slug');
     // Terra is always public.
     $this->assertContains('terra', $slugs);
     // Locke has been public since yesterday.
     $this->assertContains('locke', $slugs);
     // Edgar is public until tomorrow.
     $this->assertContains('edgar', $slugs);
     // Sabin isn't public until tomorrow.
     $this->assertNotContains('sabin', $slugs);
 }