ChartTest.php 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. /**
  3. * This file is part of PHPPresentation - A pure PHP library for reading and writing
  4. * presentations documents.
  5. *
  6. * PHPPresentation is free software distributed under the terms of the GNU Lesser
  7. * General Public License version 3 as published by the Free Software Foundation.
  8. *
  9. * For the full copyright and license information, please read the LICENSE
  10. * file that was distributed with this source code. For the full list of
  11. * contributors, visit https://github.com/PHPOffice/PHPPresentation/contributors.
  12. *
  13. * @copyright 2009-2015 PHPPresentation contributors
  14. * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
  15. * @link https://github.com/PHPOffice/PHPPresentation
  16. */
  17. namespace PhpOffice\PhpPresentation\Tests\Shape;
  18. use PhpOffice\PhpPresentation\Shape\Chart;
  19. /**
  20. * Test class for Chart element
  21. *
  22. * @coversDefaultClass PhpOffice\PhpPresentation\Shape\Chart
  23. */
  24. class ChartTest extends \PHPUnit_Framework_TestCase
  25. {
  26. public function testConstruct()
  27. {
  28. $object = new Chart();
  29. $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Title', $object->getTitle());
  30. $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Legend', $object->getLegend());
  31. $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\PlotArea', $object->getPlotArea());
  32. $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\View3D', $object->getView3D());
  33. }
  34. public function testClone()
  35. {
  36. $object = new Chart();
  37. $oClone = clone $object;
  38. $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart', $oClone);
  39. $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Title', $oClone->getTitle());
  40. $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Legend', $oClone->getLegend());
  41. $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\PlotArea', $oClone->getPlotArea());
  42. $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\View3D', $oClone->getView3D());
  43. }
  44. public function testIncludeSpreadsheet()
  45. {
  46. $object = new Chart();
  47. $this->assertFalse($object->hasIncludedSpreadsheet());
  48. $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart', $object->setIncludeSpreadsheet());
  49. $this->assertFalse($object->hasIncludedSpreadsheet());
  50. $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart', $object->setIncludeSpreadsheet(false));
  51. $this->assertFalse($object->hasIncludedSpreadsheet());
  52. $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart', $object->setIncludeSpreadsheet(true));
  53. $this->assertTrue($object->hasIncludedSpreadsheet());
  54. }
  55. }