resource() public static method

public static resource ( $controller )
Ejemplo n.º 1
0
 /**
  * @test
  */
 public function shouldSaveGeneratedUriHelperInFile()
 {
     //given
     Route::resource('users');
     $fileName = uniqid() . '_GeneratedUriHelper.php';
     $path = Path::joinWithTemp($fileName);
     $generator = UriHelperGenerator::generate();
     //when
     $generator->saveToFile($path);
     //then
     $this->assertFileExists($path);
     $this->assertEquals($generator->getGeneratedFunctions(), file_get_contents($path));
     unlink($path);
 }
Ejemplo n.º 2
0
 /**
  * @test
  */
 public function shouldFindRouteRuleWithDefaultRoute()
 {
     //given
     Route::resource('users');
     $router = $this->_createRouter('GET', '/users/');
     //when
     $rule = $router->findRoute();
     //then
     $this->assertEquals('users', $rule->getController());
     $this->assertEquals('index', $rule->getAction());
 }
Ejemplo n.º 3
0
 /**
  * @test
  */
 public function shouldSaveGeneratedUriHelperInFile()
 {
     //given
     Route::resource('users');
     $generator = JsUriHelperGenerator::generate();
     //when
     $generator->saveToFile($this->path);
     //then
     $this->assertFileExists($this->path);
     $this->assertEquals($generator->getGeneratedFunctions(), file_get_contents($this->path));
 }
Ejemplo n.º 4
0
<?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');
Ejemplo n.º 5
0
 /**
  * @test
  */
 public function shouldTraceRequestInfo()
 {
     //given
     Config::overrideProperty('debug')->with(true);
     Route::resource('restful');
     $this->get('/restful?param=1');
     //when
     $queries = Arrays::first(Stats::queries());
     //then
     ArrayAssert::that($queries['request_params'][0])->hasSize(1)->containsKeyAndValue(array('param' => 1));
 }
Ejemplo n.º 6
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');
Ejemplo n.º 7
0
 /**
  * @test
  */
 public function shouldSetRuleNameForMultipartControllerNames()
 {
     //given
     Route::resource('big_feet');
     //when
     $routes = Route::getRoutes();
     //then
     Assert::thatArray($routes)->onMethod('getName')->contains('bigFeetPath', 'freshBigFootPath', 'editBigFootPath', 'bigFootPath');
 }