|
| 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 | + * @see https://github.com/PHPOffice/PHPWord |
| 14 | + * @copyright 2010-2017 PHPWord contributors |
| 15 | + * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 |
| 16 | + */ |
| 17 | + |
| 18 | +namespace PhpOffice\PhpWord\Writer\Word2007\Style; |
| 19 | + |
| 20 | +use PhpOffice\PhpWord\Style\Table; |
| 21 | +use PhpOffice\PhpWord\TestHelperDOCX; |
| 22 | + |
| 23 | +/** |
| 24 | + * Test class for PhpOffice\PhpWord\Writer\Word2007\Style\Table |
| 25 | + * |
| 26 | + * @coversDefaultClass \PhpOffice\PhpWord\Writer\Word2007\Style\Table |
| 27 | + * @runTestsInSeparateProcesses |
| 28 | + */ |
| 29 | +class TableTest extends \PHPUnit\Framework\TestCase |
| 30 | +{ |
| 31 | + /** |
| 32 | + * Executed before each method of the class |
| 33 | + */ |
| 34 | + public function tearDown() |
| 35 | + { |
| 36 | + TestHelperDOCX::clear(); |
| 37 | + } |
| 38 | + |
| 39 | + /** |
| 40 | + * Test write styles |
| 41 | + */ |
| 42 | + public function testTableLayout() |
| 43 | + { |
| 44 | + $tableStyle = new Table(); |
| 45 | + $tableStyle->setLayout(Table::LAYOUT_FIXED); |
| 46 | + |
| 47 | + $phpWord = new \PhpOffice\PhpWord\PhpWord(); |
| 48 | + $section = $phpWord->addSection(); |
| 49 | + $table = $section->addTable($tableStyle); |
| 50 | + $table->addRow(); |
| 51 | + |
| 52 | + $doc = TestHelperDOCX::getDocument($phpWord, 'Word2007'); |
| 53 | + |
| 54 | + $path = '/w:document/w:body/w:tbl/w:tblPr/w:tblLayout'; |
| 55 | + $this->assertTrue($doc->elementExists($path)); |
| 56 | + $this->assertEquals(Table::LAYOUT_FIXED, $doc->getElementAttribute($path, 'w:type')); |
| 57 | + } |
| 58 | +} |
0 commit comments