protected function _previewAdminVideo($params) { $user = User::where(['name' => 'admin'])->first(); $this->be($user); Session::start(); $response = $this->call('POST', '/admin/video', $params + ['_token' => csrf_token()]); $result = json_decode($response->getContent()); $this->assertEquals(200, $response->getStatusCode()); $this->assertEquals(true, $result->result); $this->assertNotEmpty($result->model->preview); $getHeaders = @get_headers($result->model->preview); $this->assertEquals(true, is_numeric(stripos($getHeaders[0], '200 OK'))); $this->assertNotEmpty(exif_imagetype($result->model->preview)); $response = $this->call('DELETE', '/admin/video/' . $result->model->id, ['_token' => csrf_token()]); $result = json_decode($response->getContent()); $this->assertEquals(true, $result->result); }
public function testUser2AdminSite() { $user = User::where(['name' => 'user1'])->first(); $this->be($user); $this->_testGetAdmin(['assertRedirectedTo' => '/', 'getStatusCode' => 302]); }
protected function _simpleAdminControllerSoftDeletes($controller, $storeParams = [], $ex = []) { $user = User::where(['name' => 'admin'])->first(); $this->be($user); Session::start(); $this->_indexAction($controller); if ($storeParams) { $id = $this->_storeAction($controller, $storeParams, $ex); $this->_showAction($id, $controller, $storeParams, $ex); $this->_deleteAction($id, $controller); $this->_showActionDeleted($id, $controller, $ex); $this->_restoreAction($id, $controller); $this->_showAction($id, $controller, $storeParams, $ex); $this->_destroyAction($id, $controller); $this->_showActionDeleted($id, $controller, $ex); $id = $this->_storeAction($controller, $storeParams, $ex); $this->_deleteAction($id, $controller); $this->_destroyAction($id, $controller); } }