Nessuna descrizione

NumberingTest.php 2.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <?php
  2. /**
  3. * This file is part of PHPWord - A pure PHP library for reading and writing
  4. * word processing documents.
  5. *
  6. * PHPWord 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/PHPWord/contributors.
  12. *
  13. * @link https://github.com/PHPOffice/PHPWord
  14. * @copyright 2010-2014 PHPWord contributors
  15. * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
  16. */
  17. namespace PhpOffice\PhpWord\Tests\Writer\Word2007\Part;
  18. use PhpOffice\PhpWord\PhpWord;
  19. use PhpOffice\PhpWord\Tests\TestHelperDOCX;
  20. /**
  21. * Test class for PhpOffice\PhpWord\Writer\Word2007\Part\Numbering
  22. *
  23. * @coversDefaultClass \PhpOffice\PhpWord\Writer\Word2007\Part\Numbering
  24. * @runTestsInSeparateProcesses
  25. * @since 0.10.0
  26. */
  27. class NumberingTest extends \PHPUnit_Framework_TestCase
  28. {
  29. /**
  30. * Executed before each method of the class
  31. */
  32. public function tearDown()
  33. {
  34. TestHelperDOCX::clear();
  35. }
  36. /**
  37. * Write footnotes
  38. */
  39. public function testWriteNumbering()
  40. {
  41. $xmlFile = 'word/numbering.xml';
  42. $phpWord = new PhpWord();
  43. $phpWord->addNumberingStyle(
  44. 'numStyle',
  45. array(
  46. 'type' => 'multilevel',
  47. 'levels' => array(
  48. array(
  49. 'start' => 1,
  50. 'format' => 'decimal',
  51. 'restart' => 1,
  52. 'suffix' => 'space',
  53. 'text' => '%1.',
  54. 'align' => 'left',
  55. 'left' => 360,
  56. 'hanging' => 360,
  57. 'tabPos' => 360,
  58. 'font' => 'Arial',
  59. 'hint' => 'default',
  60. ),
  61. )
  62. )
  63. );
  64. $doc = TestHelperDOCX::getDocument($phpWord, 'Word2007');
  65. $this->assertTrue($doc->elementExists('/w:numbering/w:abstractNum', $xmlFile));
  66. }
  67. }