Пример #1
0
 public function test_delete()
 {
     $pageService = new PageService(666);
     $page = $pageService->save(true, ['en_US' => new PageLangDTO('Name US', 'Content US', 'SEO Title US', 'SEO Description US', 'handle-us')]);
     $this->DELETE("/666/pages/{$page->id}");
     $page = Page::find($page->id);
     $this->assertNotNull($page->deleted_at);
 }
Пример #2
0
 /**
  * POST /pages
  */
 public function post_page($storeId)
 {
     // TODO: Better validations
     // Validations
     $errors = $this->validate(['published' => 'boolean|required']);
     if ($errors != null) {
         return $errors;
     }
     $data = Input::all();
     $pageLangs = $this->createPageLangs($data);
     $pageService = new PageService($storeId);
     $published = $this->boolValue($data['published']);
     $page = $pageService->save($published, $pageLangs);
     return Response::json($this->adapter->format($page));
 }
Пример #3
0
 public function test_get()
 {
     $pageService = new PageService(666);
     $page = $pageService->save(true, ['en_US' => new PageLangDTO('Name US', 'Content US', 'SEO Title US', 'SEO Description US', 'handle-us')]);
     $response = $this->GET("/666/pages/{$page->id}");
     $this->assertEquals($page->id, $response->id);
     $this->assertEquals(666, $response->store_id);
     $this->assertTrue($response->published);
     $this->assertNotNull($response->created_at);
     $this->assertNotNull($response->updated_at);
     $this->assertEquals('Name US', $response->name->en_US);
     $this->assertEquals('Content US', $response->content->en_US);
     $this->assertEquals('SEO Title US', $response->seo_title->en_US);
     $this->assertEquals('SEO Description US', $response->seo_description->en_US);
     $this->assertEquals('handle-us', $response->handle->en_US);
 }