Created
May 7, 2015 07:39
-
-
Save Rokt33r/ea96c40a52898058d17b to your computer and use it in GitHub Desktop.
Laravel Test: `call` method wrapper for Angular $http ref: http://qiita.com/fluke8259/items/224dac74f62c921c9efd
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Illuminate\Http\Request; | |
class TestCase extends Illuminate\Foundation\Testing\TestCase { | |
use TestHelpersTrait; | |
/** | |
* Creates the application. | |
* | |
* @return \Illuminate\Foundation\Application | |
*/ | |
public function createApplication() | |
{ | |
$app = require __DIR__.'/../bootstrap/app.php'; | |
$app->make('Illuminate\Contracts\Console\Kernel')->bootstrap(); | |
return $app; | |
} | |
public function call($method, $uri, $parameters = [], $cookies = [], $files = [], $server = [], $content = null) | |
{ | |
$server['HTTP_Accept'] = 'application/json, text/plain, * / *'; | |
$method = strtoupper($method); | |
if($method == 'POST'|| $method == 'PUT') $server['HTTP_Content_Type'] = 'application/json'; | |
return parent::call($method, $uri, $parameters, $cookies, $files, $server, $content); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment