Exemplo n.º 1
0
 private function generateJsHelper()
 {
     $routesJSHelperPath = $this->_input->getOption('path');
     $routesJSHelperPath = Path::join($routesJSHelperPath, 'generated_uri_helper.js');
     if (JsUriHelperGenerator::generate()->saveToFile($routesJSHelperPath) !== false) {
         $this->_output->writeln("File with JS uri helpers is generated in <info>{$routesJSHelperPath}</info>");
     }
 }
Exemplo n.º 2
0
    /**
     * @test
     */
    public function shouldNotGenerateCorrectAllowAllResource()
    {
        //given
        Route::allowAll('/api', 'api');
        //when
        $generated = JsUriHelperGenerator::generate()->getGeneratedFunctions();
        //then
        $expected = <<<FUNCT
function checkParameter(parameter) {
    if (parameter === null) {
        throw new Error("Uri helper: Missing parameters");
    }
}

FUNCT;
        $this->assertEquals($expected, $generated);
    }