本文整理汇总了PHP中Route::enableFilters方法的典型用法代码示例。如果您正苦于以下问题:PHP Route::enableFilters方法的具体用法?PHP Route::enableFilters怎么用?PHP Route::enableFilters使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Route
的用法示例。
在下文中一共展示了Route::enableFilters方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testTodosRoutes
/**
* TodosControllerのテスト
*
* @return void
*/
public function testTodosRoutes()
{
// フィルタを有効にする
Route::enableFilters();
// GET /todos
$response = $this->call('GET', '/todos');
$this->assertEquals(200, $response->getStatusCode());
// POST /todos
$input = ['_token' => Session::token()];
$response = $this->call('POST', '/todos', $input);
$this->assertEquals(302, $response->getStatusCode());
$this->assertHasOldInput();
// POST /todos/1/update
$input = ['_token' => Session::token()];
$response = $this->call('POST', '/todos/1/update', $input);
$this->assertEquals(404, $response->getStatusCode());
// PUT /todos/1/title
$input = [];
$response = $this->call('PUT', '/todos/1/title', $input);
$this->assertEquals(404, $response->getStatusCode());
// POST /todos/1/delete
$input = ['_token' => Session::token()];
$response = $this->call('POST', '/todos/1/delete', $input);
$this->assertEquals(404, $response->getStatusCode());
// POST /todos/1/restore
$input = ['_token' => Session::token()];
$response = $this->call('POST', '/todos/1/restore', $input);
$this->assertEquals(404, $response->getStatusCode());
}
示例2: initTestStep
/**
* Initializes the test step by enabling filters
*
* @param bool $enableFilters
* @return void
*/
protected function initTestStep($enableFilters = TRUE)
{
$this->be(User::first());
if ($enableFilters) {
Route::enableFilters();
}
}
示例3: setUp
/**
* setUp
*/
public function setUp()
{
parent::setUp();
Artisan::call('migrate');
$this->seed(__CLASS__ . 'Seeder');
Route::enableFilters();
}
示例4: testFailToLoadDashboardBeforeLoggingIn
public function testFailToLoadDashboardBeforeLoggingIn(TestGuy $I)
{
Route::enableFilters();
$I->am('a user');
$I->amOnPage('day004_dashboard');
$I->seeInCurrentUrl('day004_login');
}
示例5: prepareForTests
/**
* Prepare for the tests to be run.
*/
public function prepareForTests()
{
// Enable your route filters, very important!
\Route::enableFilters();
\Route::any('{all}', 'Tdt\\Core\\BaseController@handleRequest')->where('all', '.*');
\Mail::pretend(true);
}
示例6: prepareForTests
protected function prepareForTests()
{
parent::prepareForTests();
Route::enableFilters();
$this->current_realm = Config::get('app.url');
$user = User::where('identifier', '=', 'sebastian.marcet')->first();
$this->be($user);
Session::start();
$scope = $this->getScopes();
$this->client_id = 'Jiz87D8/Vcvr6fvQbH4HyNgwTlfSyQ3x.openstack.client';
$this->client_secret = 'ITc/6Y5N7kOtGKhg';
$params = array('client_id' => $this->client_id, 'redirect_uri' => 'https://www.test.com/oauth2', 'response_type' => OAuth2Protocol::OAuth2Protocol_ResponseType_Code, 'scope' => implode(' ', $scope), OAuth2Protocol::OAuth2Protocol_AccessType => OAuth2Protocol::OAuth2Protocol_AccessType_Offline);
Session::set("openid.authorization.response", IAuthService::AuthorizationResponse_AllowOnce);
$response = $this->action("POST", "OAuth2ProviderController@authorize", $params, array(), array(), array());
$status = $response->getStatusCode();
$url = $response->getTargetUrl();
$content = $response->getContent();
$comps = @parse_url($url);
$query = $comps['query'];
$output = array();
parse_str($query, $output);
$params = array('code' => $output['code'], 'redirect_uri' => 'https://www.test.com/oauth2', 'grant_type' => OAuth2Protocol::OAuth2Protocol_GrantType_AuthCode);
$response = $this->action("POST", "OAuth2ProviderController@token", $params, array(), array(), array("HTTP_Authorization" => " Basic " . base64_encode($this->client_id . ':' . $this->client_secret)));
$status = $response->getStatusCode();
$this->assertResponseStatus(200);
$content = $response->getContent();
$response = json_decode($content);
$access_token = $response->access_token;
$refresh_token = $response->refresh_token;
$this->access_token = $access_token;
}
示例7: setUp
public function setUp()
{
parent::setUp();
Route::enableFilters();
$user = User::find(1);
$this->be($user);
}
示例8: testLoginRouteRedirectsWhenLoggedIn
public function testLoginRouteRedirectsWhenLoggedIn()
{
Route::enableFilters();
$user = $this->factory->create('user');
Sentry::login($user);
$this->client->request('GET', URL::action('AuthController@getLogin'));
$this->assertRedirectedTo('/');
}
示例9: setUp
/**
* Set session and enable Laravel filters
*
*/
public function setUp()
{
parent::setUp();
// Enable session
Session::start();
// Enable filters
Route::enableFilters();
}
示例10: setup
public function setup()
{
parent::setUp();
Session::start();
//enable filters as filters are disabled by default
Route::enableFilters();
$this->prepareForTests();
}
示例11: request
protected function request($method = 'GET', $uri = '', $params = [], $server = [], $content = null)
{
$files = [];
$changeHistory = true;
\Route::enableFilters();
// http://laravel.com/api/4.2/Illuminate/Foundation/Testing/TestCase.html#method_call
return $this->call($method, $uri, $params, $files, $server, $content, $changeHistory);
}
示例12: createApplication
/**
* Creates the application.
*
* @return \Symfony\Component\HttpKernel\HttpKernelInterface
*/
public function createApplication()
{
$unitTesting = true;
$testEnvironment = 'testing';
return require __DIR__ . '/../../bootstrap/start.php';
Session::start();
Route::enableFilters();
}
示例13: testCreateBillFailBillIdIsset
/**
*
* @return void
*/
public function testCreateBillFailBillIdIsset()
{
Route::enableFilters();
$this->call('PUT', Config::get('ff-qiwi-gate::app.url') . '/qiwi/gate/api/v2/prv/1/bills/4a5s6d', array('user' => 'tel:+79161234567', 'amount' => '123.34', 'ccy' => 'RUB', 'comment' => 'Test!'), array(), array('HTTP_Authorization' => 'Basic ' . base64_encode('1:password')));
$oResponse = $this->response()->getData();
$this->assertEquals(215, $oResponse->response->result_code);
$this->assertEquals(403, $this->client->getResponse()->getStatusCode());
}
示例14: setUp
public function setUp()
{
parent::setUp();
Route::enableFilters();
// Authentication as super user.
$user = User::firstOrCreate(['email' => 'quan@ll.com']);
Auth::login($user);
}
示例15: testTracking
public function testTracking()
{
Route::enableFilters();
$request = Request::instance();
$ab = Mockery::mock('Jamesblackwell\\AB\\Tester');
$ab->shouldReceive('track')->with($request)->once();
$this->app['ab'] = $ab;
$this->app->events->fire('router.before', [$request]);
}