laravel test Laravel
・requestの形を統一する
Mockery;
https://medium.com/laravel-4/laravel-4-controller-testing-48414f4782d0#.qreur0n73
・repositoriテスト
http://www.developer.com/services/testing-controllers-in-laravel-with-the-service-container.html
Mockery::
クラス内でnewしないようにする
http://tech.aainc.co.jp/archives/3918
https://readouble.com/laravel/5.1/ja/testing.html
----------
<?php
namespace Formativ;
use Illuminate¥Http¥Request;
use Str;
class PostRepository implements PostRepositoryInterface
{
public function __construct(Request $request)
{
$this->request = $request;
}
public function insert()
{
$data = [
"title" => $this->request->get("title")
"subtitle" => $this->request->get("subtitle")
"body" => $this->request->get("body")
"author_id" => $this->request->get("author")
"slug" => Str::slug($this->request->get("title"))
];