Skip to content

Commit

Permalink
Add event all attributes test
Browse files Browse the repository at this point in the history
  • Loading branch information
Edofre committed Mar 17, 2017
1 parent 54c867b commit fc053d6
Showing 1 changed file with 53 additions and 6 deletions.
59 changes: 53 additions & 6 deletions tests/Integration/EventTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Edofre\Fullcalendar\Test\Integration;

use Carbon\Carbon;
use Edofre\Fullcalendar\Event;

/**
* Class EventTest
Expand All @@ -13,27 +14,73 @@ class EventTest extends \Orchestra\Testbench\TestCase
/** @test */
public function generate_event_with_id()
{
$model = new \Edofre\Fullcalendar\Event(
$event = new Event(
[
'id' => 1,
]
);

$this->assertEquals('1', $model->id);
$this->assertNotEquals('2', $model->id);
$this->assertEquals('1', $event->id);
$this->assertNotEquals('2', $event->id);
}

/** @test */
public function generate_event_with_start_end_dates()
{
$model = new \Edofre\Fullcalendar\Event(
$event = new Event(
[
'start' => Carbon::create(2016, 11, 16, 10),
'end' => Carbon::create(2016, 11, 16, 13),
]
);

$this->assertEquals("2016-11-16T10:00:00+00:00", $model->start);
$this->assertNotEquals("2016-11-16T10:00:00+00:00", $model->end);
$this->assertEquals("2016-11-16T10:00:00+00:00", $event->start);
$this->assertNotEquals("2016-11-16T10:00:00+00:00", $event->end);
}

/** @test */
public function generate_event_with_all_attributes()
{
$event = new Event(
[
'id' => '1',
'title' => 'Test event',
'allDay' => false,
'start' => Carbon::create(2016, 11, 16, 10),
'end' => Carbon::create(2016, 11, 16, 13),
'url' => 'www.test.dev',
'className' => 'test-event',
'editable' => true,
'startEditable' => true,
'durationEditable' => true,
'rendering' => Event::RENDERING_BACKGROUND,
'overlap' => false,
'constraint' => 'businessHours',
'color' => '',
'backgroundColor' => 'red',
'borderColor' => 'black',
'textColor' => 'black',
]
);

$this->assertNotEquals('2', $event->id);
$this->assertEquals("Test event", $event->title);
$this->assertEquals(false, $event->allDay);
$this->assertEquals("2016-11-16T10:00:00+00:00", $event->start);
$this->assertNotEquals("2016-11-16T10:00:00+00:00", $event->end);
$this->assertEquals('www.test.dev', $event->url);
$this->assertNotEquals('event-test', $event->className);
$this->assertEquals(true, $event->editable);
$this->assertEquals(true, $event->startEditable);
$this->assertNotEquals(false, $event->durationEditable);
$this->assertNotEquals(Event::RENDERING_INVERSE_BACKGROUND, $event->rendering);
$this->assertNotEquals(true, $event->overlap);
$this->assertEquals('businessHours', $event->constraint);
$this->assertNotEquals('purple', $event->color);
$this->assertEquals('red', $event->backgroundColor);
$this->assertNotEquals('pink', $event->borderColor);
$this->assertEquals('black', $event->textColor);


}
}

0 comments on commit fc053d6

Please sign in to comment.