<?php

use Illuminate\Foundation\Testing\WithoutMiddleware;
use Laravel\Lumen\Testing\DatabaseMigrations;

class _camel_case_IntegrationTest extends TestCase
{
    use DatabaseMigrations;

    public function setUp()
    {
        parent::setUp();
        $this->app->instance('middleware.disable', true);

        $this->_lower_case_ = factory(_namespace_model_\_camel_case_::class)->make([
            // _camel_case_ table data
        ]);
        $this->_lower_case_Edited = factory(_namespace_model_\_camel_case_::class)->make([
            // _camel_case_ table data
        ]);
    }

    public function testIndex()
    {
        $this->get('api/v1/_lower_casePlural_');
        $this->assertEquals(200, $this->response->getStatusCode());
    }

    public function testStore()
    {
        $this->post('api/v1/_lower_casePlural_', $this->_lower_case_->toArray());
        $this->assertEquals(200, $this->response->getStatusCode());
    }

    public function testShow()
    {
        factory(_namespace_model_\_camel_case_::class)->create($this->_lower_case_->toArray());
        $this->get('api/v1/_lower_casePlural_/'.$this->_lower_case_->id);
        $this->assertEquals(200, $this->response->getStatusCode());
    }

    public function testUpdate()
    {
        factory(_namespace_model_\_camel_case_::class)->create($this->_lower_case_->toArray());
        $this->patch('api/v1/_lower_casePlural_/1', $this->_lower_case_Edited->toArray());
        $this->assertEquals(200, $this->response->getStatusCode());
        $this->assertDatabaseHas('_lower_casePlural_', $this->_lower_case_Edited->toArray());
    }

    public function testDelete()
    {
        factory(_namespace_model_\_camel_case_::class)->create($this->_lower_case_->toArray());
        $this->delete('api/v1/_lower_casePlural_/'.$this->_lower_case_->id);
        $this->assertEquals(200, $this->response->getStatusCode());
    }

}
