コード例 #1
0
 protected function removeDeprecatedPages()
 {
     foreach ($this->differ->deprecatedPages() as $pageName) {
         $page = Page::where('name', $pageName)->first();
         $page->delete();
     }
     return $this;
 }
コード例 #2
0
 private function seedDatabaseWithBasicContentStructure()
 {
     //build up database content
     $home = Page::create(['name' => 'home', 'description' => 'The homepage']);
     $about = Page::create(['name' => 'about', 'description' => 'The about page']);
     Page::create(['name' => 'contact', 'description' => 'The contact page']);
     $home->addTextblock('intro', 'The homepage intro');
     $home->addTextblock('spiel', 'Company story', true);
     $home->addGallery('slider', 'Homepage banner slide images');
     $about->addTextblock('intro', 'The about page intro');
     $about->addTextblock('spiel', 'My story', true);
     $about->addGallery('slider', 'About page banner slide images');
 }
コード例 #3
0
 protected function seeBasicConfigInDatabase()
 {
     // $this->seeInDatabase('ec_pages', [
     //     'name' => 'home'
     // ]);
     $this->assertCount(1, Page::where('name', 'home')->get());
     $this->seeInDatabase('ec_pages', ['name' => 'about']);
     $this->seeInDatabase('ec_pages', ['name' => 'contact']);
     $this->seeInDatabase('ec_textblocks', ['name' => 'intro', 'description' => 'The homepage intro', 'allows_html' => 0]);
     $this->seeInDatabase('ec_textblocks', ['name' => 'intro', 'description' => 'The about page intro', 'allows_html' => 0]);
     $this->seeInDatabase('ec_textblocks', ['name' => 'spiel', 'description' => 'Company story', 'allows_html' => 1]);
     $this->seeInDatabase('ec_textblocks', ['name' => 'spiel', 'description' => 'My story', 'allows_html' => 1]);
     $this->seeInDatabase('ec_galleries', ['name' => 'slider', 'description' => 'Homepage banner slide images', 'is_single' => 0]);
     $this->seeInDatabase('ec_galleries', ['name' => 'slider', 'description' => 'About page banner slide images', 'is_single' => 0]);
 }
コード例 #4
0
 public function getPageListWithUrls()
 {
     return collect(Page::all()->map(function ($page) {
         return ['name' => $page->name, 'url' => '/package-edible/pages/' . $page->id];
     })->toArray());
 }
コード例 #5
0
 public function editGallery($pageId, $galleryId)
 {
     $gallery = Gallery::findOrFail($galleryId);
     $page = Page::findOrFail($pageId);
     return view('vendor.edible.gallery')->with(compact('gallery', 'page'));
 }
コード例 #6
0
ファイル: ContentTest.php プロジェクト: michaeljoyner/edible
 /**
  *@test
  */
 public function the_content_repo_can_return_a_collection_of_all_page_names_and_urls()
 {
     $repo = new ContentRepository();
     $home = Page::create(['name' => 'home', 'description' => 'The homepage']);
     $about = Page::create(['name' => 'about', 'description' => 'The about page']);
     $expected = collect([['name' => 'home', 'url' => '/package-edible/pages/' . $home->id], ['name' => 'about', 'url' => '/package-edible/pages/' . $about->id]]);
     $this->assertEquals($expected, $repo->getPageListWithUrls());
 }
コード例 #7
0
ファイル: TestCase.php プロジェクト: michaeljoyner/edible
 protected function notSeeInDatabase($table, $attributes)
 {
     switch ($table) {
         case 'ec_pages':
             $q = null;
             foreach ($attributes as $key => $value) {
                 if (is_null($q)) {
                     $q = Page::where($key, $value);
                 } else {
                     $q = $q->where($key, $value);
                 }
             }
             $this->assertCount(0, $q->get());
             break;
         case 'ec_textblocks':
             $q = null;
             foreach ($attributes as $key => $value) {
                 if (is_null($q)) {
                     $q = Textblock::where($key, $value);
                 } else {
                     $q = $q->where($key, $value);
                 }
             }
             $this->assertCount(0, $q->get());
             break;
         case 'ec_galleries':
             $q = null;
             foreach ($attributes as $key => $value) {
                 if (is_null($q)) {
                     $q = Gallery::where($key, $value);
                 } else {
                     $q = $q->where($key, $value);
                 }
             }
             $this->assertCount(0, $q->get());
             break;
         default:
             # code...
             break;
     }
 }