BreakElementTes 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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\RichText;
  18. use PhpOffice\PhpPresentation\Shape\RichText\BreakElement;
  19. /**
  20. * Test class for BreakElement element
  21. *
  22. * @coversDefaultClass PhpOffice\PhpPresentation\Shape\RichText\BreakElement
  23. */
  24. class BreakElementTest extends \PHPUnit_Framework_TestCase
  25. {
  26. /**
  27. * Test can read
  28. */
  29. public function testText()
  30. {
  31. $object = new BreakElement();
  32. $this->assertEquals("\r\n", $object->getText());
  33. $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\BreakElement', $object->setText());
  34. $this->assertEquals("\r\n", $object->getText());
  35. $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\BreakElement', $object->setText('AAA'));
  36. $this->assertEquals("\r\n", $object->getText());
  37. }
  38. public function testFont()
  39. {
  40. $object = new BreakElement();
  41. $this->assertNull($object->getFont());
  42. }
  43. public function testLanguage()
  44. {
  45. $object = new BreakElement();
  46. $this->assertNull($object->getLanguage());
  47. $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\BreakElement', $object->setLanguage('en-US'));
  48. $this->assertNull($object->getLanguage());
  49. }
  50. /**
  51. * Test get/set hash index
  52. */
  53. public function testHashCode()
  54. {
  55. $object = new BreakElement();
  56. $this->assertEquals(md5(get_class($object)), $object->getHashCode());
  57. }
  58. }