|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Ob\HighchartsBundle\Tests\Highstock; |
|
4
|
|
|
|
|
5
|
|
|
use Ob\HighchartsBundle\Highcharts\Highstock; |
|
6
|
|
|
|
|
7
|
|
|
class RangeSelectorTest extends \PHPUnit_Framework_TestCase |
|
8
|
|
|
{ |
|
9
|
|
|
protected $chart; |
|
10
|
|
|
protected $range; |
|
11
|
|
|
|
|
12
|
|
|
protected function setUp() |
|
13
|
|
|
{ |
|
14
|
|
|
$this->chart = new Highstock(); |
|
15
|
|
|
$this->range = $this->chart->rangeSelector; |
|
16
|
|
|
} |
|
17
|
|
|
|
|
18
|
|
|
public function testButtonSpacing() |
|
19
|
|
|
{ |
|
20
|
|
|
$spacing = 0; |
|
21
|
|
|
$this->range->buttonSpacing($spacing); |
|
22
|
|
|
$this->assertEquals($spacing, $this->range->buttonSpacing); |
|
23
|
|
|
$this->assertRegExp('/"buttonSpacing":0/', $this->chart->render()); |
|
24
|
|
|
} |
|
25
|
|
|
|
|
26
|
|
|
public function testButtonTheme() |
|
27
|
|
|
{ |
|
28
|
|
|
$this->markTestIncomplete(); |
|
29
|
|
|
} |
|
30
|
|
|
|
|
31
|
|
|
public function testButtons() |
|
32
|
|
|
{ |
|
33
|
|
|
$buttons = array(array( |
|
34
|
|
|
'type' => 'month', |
|
35
|
|
|
'count' => 3, |
|
36
|
|
|
'text' => '3m' |
|
37
|
|
|
)); |
|
38
|
|
|
|
|
39
|
|
|
$this->range->buttons($buttons); |
|
40
|
|
|
$this->assertEquals($buttons, $this->range->buttons); |
|
41
|
|
|
$this->assertRegExp('/"buttons":\[{"type":"month","count":3,"text":"3m"}\]/', $this->chart->render()); |
|
42
|
|
|
} |
|
43
|
|
|
|
|
44
|
|
|
public function testEnabled() |
|
45
|
|
|
{ |
|
46
|
|
|
$this->range->enabled(true); |
|
47
|
|
|
$this->assertTrue($this->range->enabled); |
|
48
|
|
|
$this->assertRegExp('/"enabled":true/', $this->chart->render()); |
|
49
|
|
|
|
|
50
|
|
|
$this->range->enabled(false); |
|
51
|
|
|
$this->assertFalse($this->range->enabled); |
|
52
|
|
|
$this->assertRegExp('/"enabled":false/', $this->chart->render()); |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
|
|
public function testInputBoxBorderColor() |
|
56
|
|
|
{ |
|
57
|
|
|
$color = 'silver'; |
|
58
|
|
|
$this->range->inputBoxBorderColor($color); |
|
59
|
|
|
$this->assertEquals($color, $this->range->inputBoxBorderColor); |
|
60
|
|
|
$this->assertRegExp('/"inputBoxBorderColor":"silver"/', $this->chart->render()); |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
public function testInputBoxHeight() |
|
64
|
|
|
{ |
|
65
|
|
|
$height = 16; |
|
66
|
|
|
$this->range->inputBoxHeight($height); |
|
67
|
|
|
$this->assertEquals($height, $this->range->inputBoxHeight); |
|
68
|
|
|
$this->assertRegExp('/"inputBoxHeight":16/', $this->chart->render()); |
|
69
|
|
|
} |
|
70
|
|
|
|
|
71
|
|
|
public function testInputBoxWidth() |
|
72
|
|
|
{ |
|
73
|
|
|
$width = 16; |
|
74
|
|
|
$this->range->inputBoxWidth($width); |
|
75
|
|
|
$this->assertEquals($width, $this->range->inputBoxWidth); |
|
76
|
|
|
$this->assertRegExp('/"inputBoxWidth":16/', $this->chart->render()); |
|
77
|
|
|
} |
|
78
|
|
|
|
|
79
|
|
|
public function testInputDateFormat() |
|
80
|
|
|
{ |
|
81
|
|
|
$format = '%b %e, %Y'; |
|
82
|
|
|
$this->range->inputDateFormat($format); |
|
83
|
|
|
$this->assertEquals($format, $this->range->inputDateFormat); |
|
84
|
|
|
$this->assertRegExp('/"inputDateFormat":"%b %e, %Y"/', $this->chart->render()); |
|
85
|
|
|
} |
|
86
|
|
|
|
|
87
|
|
|
public function testInputDateParser() |
|
88
|
|
|
{ |
|
89
|
|
|
$this->markTestIncomplete(); |
|
90
|
|
|
} |
|
91
|
|
|
|
|
92
|
|
|
public function testInputEditDateFormat() |
|
93
|
|
|
{ |
|
94
|
|
|
$format = '%b %e, %Y'; |
|
95
|
|
|
$this->range->inputEditDateFormat($format); |
|
96
|
|
|
$this->assertEquals($format, $this->range->inputEditDateFormat); |
|
97
|
|
|
$this->assertRegExp('/"inputEditDateFormat":"%b %e, %Y"/', $this->chart->render()); |
|
98
|
|
|
} |
|
99
|
|
|
|
|
100
|
|
|
public function testinputEnabled() |
|
101
|
|
|
{ |
|
102
|
|
|
$this->range->inputEnabled(true); |
|
103
|
|
|
$this->assertTrue($this->range->inputEnabled); |
|
104
|
|
|
$this->assertRegExp('/"inputEnabled":true/', $this->chart->render()); |
|
105
|
|
|
|
|
106
|
|
|
$this->range->inputEnabled(false); |
|
107
|
|
|
$this->assertFalse($this->range->inputEnabled); |
|
108
|
|
|
$this->assertRegExp('/"inputEnabled":false/', $this->chart->render()); |
|
109
|
|
|
} |
|
110
|
|
|
|
|
111
|
|
|
public function testInputPosition() |
|
112
|
|
|
{ |
|
113
|
|
|
$position= array( |
|
114
|
|
|
'align' => 'right' |
|
115
|
|
|
); |
|
116
|
|
|
$this->range->position($position); |
|
117
|
|
|
$this->assertEquals($position, $this->range->position); |
|
118
|
|
|
$this->assertRegExp('/"position":{"align":"right"}/', $this->chart->render()); |
|
119
|
|
|
} |
|
120
|
|
|
|
|
121
|
|
|
public function testInputStyle() |
|
122
|
|
|
{ |
|
123
|
|
|
$this->markTestIncomplete(); |
|
124
|
|
|
} |
|
125
|
|
|
|
|
126
|
|
|
public function testLabelStyle() |
|
127
|
|
|
{ |
|
128
|
|
|
$this->markTestIncomplete(); |
|
129
|
|
|
} |
|
130
|
|
|
|
|
131
|
|
|
public function testSelected() |
|
132
|
|
|
{ |
|
133
|
|
|
$index = 3; |
|
134
|
|
|
$this->range->selected($index); |
|
135
|
|
|
$this->assertEquals($index, $this->range->selected); |
|
136
|
|
|
$this->assertRegExp('/"selected":3/', $this->chart->render()); |
|
137
|
|
|
} |
|
138
|
|
|
} |
|
139
|
|
|
|