|
17 | 17 |
|
18 | 18 | namespace PhpOffice\PhpPresentation\Tests\Shape\Chart; |
19 | 19 |
|
20 | | -use PhpOffice\PhpPresentation\Shape\Chart\Legend; |
21 | | -use PhpOffice\PhpPresentation\Style\Alignment; |
22 | | -use PhpOffice\PhpPresentation\Style\Border; |
23 | | -use PhpOffice\PhpPresentation\Style\Fill; |
| 20 | +use PhpOffice\PhpPresentation\Shape\Chart\Axis; |
24 | 21 | use PhpOffice\PhpPresentation\Style\Font; |
25 | 22 |
|
26 | 23 | /** |
27 | | - * Test class for Legend element |
| 24 | + * Test class for Axis element |
28 | 25 | * |
29 | | - * @coversDefaultClass PhpOffice\PhpPresentation\Shape\Chart\Legend |
| 26 | + * @coversDefaultClass PhpOffice\PhpPresentation\Shape\Chart\Axis |
30 | 27 | */ |
31 | 28 | class AxisTest extends \PHPUnit_Framework_TestCase |
32 | 29 | { |
33 | 30 | public function testConstruct() |
34 | 31 | { |
35 | | - $object = new Legend(); |
| 32 | + $object = new Axis(); |
36 | 33 |
|
| 34 | + $this->assertEquals('Axis Title', $object->getTitle()); |
37 | 35 | $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Font', $object->getFont()); |
38 | | - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Border', $object->getBorder()); |
39 | | - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Fill', $object->getFill()); |
40 | | - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Alignment', $object->getAlignment()); |
41 | 36 | } |
42 | 37 |
|
43 | | - public function testAlignment() |
| 38 | + public function testFormatCode() |
44 | 39 | { |
45 | | - $object = new Legend(); |
46 | | - |
47 | | - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Legend', $object->setAlignment(new Alignment())); |
48 | | - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Alignment', $object->getAlignment()); |
49 | | - } |
50 | | - |
51 | | - public function testFont() |
52 | | - { |
53 | | - $object = new Legend(); |
54 | | - |
55 | | - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Legend', $object->setFont()); |
56 | | - $this->assertNull($object->getFont()); |
57 | | - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Legend', $object->setFont(new Font())); |
58 | | - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Font', $object->getFont()); |
| 40 | + $object = new Axis(); |
| 41 | + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Axis', $object->setFormatCode()); |
| 42 | + $this->assertEquals('', $object->getFormatCode()); |
| 43 | + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Axis', $object->setFormatCode('AAAA')); |
| 44 | + $this->assertEquals('AAAA', $object->getFormatCode()); |
59 | 45 | } |
60 | 46 |
|
61 | 47 | public function testHashIndex() |
62 | 48 | { |
63 | | - $object = new Legend(); |
| 49 | + $object = new Axis(); |
64 | 50 | $value = rand(1, 100); |
65 | 51 |
|
66 | 52 | $this->assertEmpty($object->getHashIndex()); |
67 | | - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Legend', $object->setHashIndex($value)); |
| 53 | + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Axis', $object->setHashIndex($value)); |
68 | 54 | $this->assertEquals($value, $object->getHashIndex()); |
69 | 55 | } |
70 | 56 |
|
71 | | - public function testHeight() |
72 | | - { |
73 | | - $object = new Legend(); |
74 | | - $value = rand(0, 100); |
75 | | - |
76 | | - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Legend', $object->setHeight()); |
77 | | - $this->assertEquals(0, $object->getHeight()); |
78 | | - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Legend', $object->setHeight($value)); |
79 | | - $this->assertEquals($value, $object->getHeight()); |
80 | | - } |
81 | | - |
82 | | - public function testOffsetX() |
83 | | - { |
84 | | - $object = new Legend(); |
85 | | - $value = rand(0, 100); |
86 | | - |
87 | | - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Legend', $object->setOffsetX()); |
88 | | - $this->assertEquals(0, $object->getOffsetX()); |
89 | | - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Legend', $object->setOffsetX($value)); |
90 | | - $this->assertEquals($value, $object->getOffsetX()); |
91 | | - } |
92 | | - |
93 | | - public function testOffsetY() |
94 | | - { |
95 | | - $object = new Legend(); |
96 | | - $value = rand(0, 100); |
97 | | - |
98 | | - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Legend', $object->setOffsetY()); |
99 | | - $this->assertEquals(0, $object->getOffsetY()); |
100 | | - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Legend', $object->setOffsetY($value)); |
101 | | - $this->assertEquals($value, $object->getOffsetY()); |
102 | | - } |
103 | | - |
104 | | - public function testPosition() |
105 | | - { |
106 | | - $object = new Legend(); |
107 | | - |
108 | | - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Legend', $object->setPosition()); |
109 | | - $this->assertEquals(Legend::POSITION_RIGHT, $object->getPosition()); |
110 | | - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Legend', $object->setPosition(Legend::POSITION_BOTTOM)); |
111 | | - $this->assertEquals(Legend::POSITION_BOTTOM, $object->getPosition()); |
112 | | - } |
113 | | - |
114 | | - public function testVisible() |
| 57 | + public function testTitle() |
115 | 58 | { |
116 | | - $object = new Legend(); |
117 | | - |
118 | | - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Legend', $object->setVisible()); |
119 | | - $this->assertTrue($object->isVisible()); |
120 | | - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Legend', $object->setVisible(true)); |
121 | | - $this->assertTrue($object->isVisible()); |
122 | | - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Legend', $object->setVisible(false)); |
123 | | - $this->assertFalse($object->isVisible()); |
| 59 | + $object = new Axis(); |
| 60 | + $this->assertEquals('Axis Title', $object->getTitle()); |
| 61 | + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Axis', $object->setTitle('AAAA')); |
| 62 | + $this->assertEquals('AAAA', $object->getTitle()); |
124 | 63 | } |
125 | 64 |
|
126 | | - public function testWidth() |
| 65 | + public function testFont() |
127 | 66 | { |
128 | | - $object = new Legend(); |
129 | | - $value = rand(0, 100); |
| 67 | + $object = new Axis(); |
130 | 68 |
|
131 | | - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Legend', $object->setWidth()); |
132 | | - $this->assertEquals(0, $object->getWidth()); |
133 | | - $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Legend', $object->setWidth($value)); |
134 | | - $this->assertEquals($value, $object->getWidth()); |
| 69 | + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Axis', $object->setFont()); |
| 70 | + $this->assertNull($object->getFont()); |
| 71 | + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Axis', $object->setFont(new Font())); |
| 72 | + $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Font', $object->getFont()); |
135 | 73 | } |
136 | 74 | } |
0 commit comments