post() 공개 정적인 메소드

public static post ( $uri, $action, array $options = [] )
$options array
예제 #1
0
    /**
     * @test
     */
    public function shouldGenerateUriHelperForPost()
    {
        //given
        Route::post('/users/save', 'users#save');
        //when
        $generated = UriHelperGenerator::generate()->getGeneratedFunctions();
        //then
        $expected = <<<FUNCT
<?php
function checkParameter(\$parameter)
{
    if (!isset(\$parameter)) {
        throw new \\InvalidArgumentException("Missing parameters");
    }
}

function saveUsersPath()
{
    return url("/users/save");
}

function allGeneratedUriNames()
{
    return array('saveUsersPath');
}
FUNCT;
        $this->assertEquals($expected, $generated);
    }
예제 #2
0
    /**
     * @test
     */
    public function shouldGenerateUriHelperForPost()
    {
        //given
        Route::post('/users/save', 'users#save');
        //when
        $generated = JsUriHelperGenerator::generate()->getGeneratedFunctions();
        //then
        $expected = <<<FUNCT
function checkParameter(parameter) {
    if (parameter === null) {
        throw new Error("Uri helper: Missing parameters");
    }
}

function saveUsersPath() {
    return "/app/users/save";
}

FUNCT;
        $this->assertEquals($expected, $generated);
    }
예제 #3
0
 /**
  * @test
  */
 public function shouldFindRouteRuleUtf8()
 {
     //given
     Route::post('/api/agents/:login/free', 'api/agents#free');
     $router = $this->_createRouter('POST', '/api/agents/userπ/free');
     //when
     $rule = $router->findRoute();
     //then
     $this->assertEquals('/api/agents/:login/free', $rule->getUri());
     $this->assertEquals('POST', $rule->getMethod());
     $this->assertEquals('api/agents', $rule->getController());
     $this->assertEquals('free', $rule->getAction());
 }
예제 #4
0
파일: routes.php 프로젝트: letsdrink/ouzo
<?php

/*
 * Copyright (c) Ouzo contributors, http://ouzoframework.org
 * This file is made available under the MIT License (view the LICENSE file for more information).
 */
use Ouzo\Routing\Route;
Route::get('/', 'index#index');
Route::allowAll('/users', 'users', array('except' => array('new', 'select_outbound_for_user')));
Route::get('/agents/index', 'agents#index');
Route::post('/agents/index', 'agents#index');
Route::allowAll('/photos', 'photos');
Route::any('/agents/index', 'agents#index');
Route::resource('phones');
Route::get('/agents', 'agents#index', array('as' => 'my_name'));
Route::get('/agents/show/id/:id/call_id/:call_id', 'agents#show');
예제 #5
0
 /**
  * @test
  */
 public function shouldRemoveDuplicatedPrefixFromUrlWhenExists()
 {
     //given
     Route::post('/sample/redirect_to', 'sample#redirect_to');
     //when
     $this->post('/sample/redirect_to', array());
     //then
     $this->assertRedirectsTo('/sample/add');
 }
예제 #6
0
 /**
  * @test
  */
 public function shouldPassOnlyUrlParametersNotPostOrGet()
 {
     // given
     Route::post('/simple_test2/receive_params/:user', 'simple_test#receive_params');
     // when
     CatchException::when($this)->post('/simple_test2/receive_params/Cersei', array('page' => 'about-us'));
     // then
     $this->assertRenderedContent()->isEqualTo(null);
     CatchException::assertThat()->hasMessage('Missing argument 2 for SimpleTestController::receive_params()');
 }
예제 #7
0
<?php

use Ouzo\Routing\Route;
Route::get('/', 'home#index');
Route::get('/new_game', 'games#new_game');
Route::get('/end_game', 'games#end_game');
Route::get('/test', 'games#test');
Route::get('/game_content', 'games#game_content');
Route::get('/games', 'games#index');
Route::get('/games/current', 'games#game');
Route::get('/games/:id', 'games#show');
Route::post('/games', 'games#create');
Route::post('/games/new', 'games#create_new');
Route::post('/games/restart', 'games#restart');
Route::post('/games/cancel', 'games#cancel');
Route::post('/games/next_player', 'games#next_player');
Route::post('/long_poll', 'events#poll');
Route::post('/hit', 'hits#index');
Route::resource('players');
예제 #8
0
 /**
  * @test
  */
 public function shouldSetRuleNameForMultipartCamelcaseAction()
 {
     //given
     Route::post('/users/save', 'users#saveMyUser');
     //when
     $routes = Route::getRoutes();
     //then
     $this->assertEquals('saveMyUserUsersPath', $routes[0]->getName());
 }