|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace CalendarBundle\Tests\Entity; |
|
4
|
|
|
|
|
5
|
|
|
use PhpSpec\ObjectBehavior; |
|
|
|
|
|
|
6
|
|
|
use CalendarBundle\Entity\Event; |
|
7
|
|
|
use PHPUnit\Framework\TestCase; |
|
8
|
|
|
|
|
9
|
|
|
class EventTest extends TestCase |
|
10
|
|
|
{ |
|
11
|
|
|
private $title; |
|
12
|
|
|
private $start; |
|
13
|
|
|
private $end; |
|
14
|
|
|
private $options; |
|
15
|
|
|
|
|
16
|
|
|
public function setUp(): void |
|
17
|
|
|
{ |
|
18
|
|
|
$this->title = 'Title'; |
|
19
|
|
|
$this->start = new \DateTime('2019-03-18 08:41:31'); |
|
20
|
|
|
$this->end = new \DateTime('2019-03-18 08:41:31'); |
|
21
|
|
|
$this->options = ['textColor' => 'blue']; |
|
22
|
|
|
|
|
23
|
|
|
$this->entity = new Event( |
|
|
|
|
|
|
24
|
|
|
$this->title, |
|
25
|
|
|
$this->start, |
|
26
|
|
|
$this->end, |
|
27
|
|
|
$this->options |
|
28
|
|
|
); |
|
29
|
|
|
} |
|
30
|
|
|
|
|
31
|
|
|
public function testItHasRequireValues() |
|
32
|
|
|
{ |
|
33
|
|
|
$this->assertEquals($this->title, $this->entity->getTitle()); |
|
34
|
|
|
$this->assertEquals($this->start, $this->entity->getStart()); |
|
35
|
|
|
$this->assertEquals($this->end, $this->entity->getEnd()); |
|
36
|
|
|
$this->assertEquals($this->options, $this->entity->getOptions()); |
|
37
|
|
|
} |
|
38
|
|
|
|
|
39
|
|
|
public function testItShouldConvertItsValuesInToArray() |
|
40
|
|
|
{ |
|
41
|
|
|
$url = 'url'; |
|
42
|
|
|
$urlValue = 'www.url.com'; |
|
43
|
|
|
|
|
44
|
|
|
$options = [ |
|
45
|
|
|
$url => $urlValue, |
|
46
|
|
|
]; |
|
47
|
|
|
|
|
48
|
|
|
$allDay = false; |
|
49
|
|
|
|
|
50
|
|
|
$this->entity->setAllDay($allDay); |
|
51
|
|
|
|
|
52
|
|
|
$this->entity->addOption('be-removed', 'value'); |
|
53
|
|
|
$this->entity->removeOption('be-removed'); |
|
54
|
|
|
|
|
55
|
|
|
$this->assertEquals(null, $this->entity->removeOption('no-found-key')); |
|
56
|
|
|
|
|
57
|
|
|
$this->entity->setOptions($options); |
|
58
|
|
|
$this->assertEquals($options, $this->entity->getOptions()); |
|
59
|
|
|
|
|
60
|
|
|
$this->assertEquals($urlValue, $this->entity->getOption($url, $urlValue)); |
|
61
|
|
|
|
|
62
|
|
|
$this->assertEquals( |
|
63
|
|
|
[ |
|
64
|
|
|
'title' => $this->title, |
|
65
|
|
|
'start' => $this->start->format('Y-m-d\\TH:i:sP'), |
|
66
|
|
|
'allDay' => $allDay, |
|
67
|
|
|
'end' => $this->end->format('Y-m-d\\TH:i:sP'), |
|
68
|
|
|
$url => $urlValue, |
|
69
|
|
|
], |
|
70
|
|
|
$this->entity->toArray() |
|
71
|
|
|
); |
|
72
|
|
|
} |
|
73
|
|
|
} |
|
74
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths