<?php
/**
 * Created by PhpStorm.
 * User: oriol
 * Date: 28/04/16
 * Time: 19:02
 */

namespace tests\controllers;
use App\Http\Controllers\CalendariFestiusController;
use App\DatesFestius;


class ACalendariFestiusControllerTest extends \TestCase
{

    public function testCalendariFestiusControllerTest()
    {
        $CalendariFestiusController = new CalendariFestiusController();
        //$this->artisan('migrate:refresh');
    }
    public function testinsertData()
    {
        $this->WithoutMiddleware();
        $CalendariFestiusController = new CalendariFestiusController();
        $data_inici = '2016-05-01';
        $data_fi = '2016-06-23';
        $descripcio = 'Pont 1 de maig';
        $this->call('POST', '/festius',['start' => $data_inici,'end' => $data_fi,'descripcio' => $descripcio]);
        $this->assertRedirectedTo('/festius', $with = []);
        $datesFestius = new DatesFestius();
        $result = $datesFestius->llistarDates();
        $this->assertEquals($result[0]->data_inici,'2016-05-01 00:00:00');
        $this->assertEquals($result[0]->data_fi,'2016-06-23 00:00:00');
    }


}
