2014-03-10 03:20:24 +07:00
|
|
|
<?php
|
2014-03-27 23:55:06 +07:00
|
|
|
/**
|
|
|
|
|
* PHPWord
|
|
|
|
|
*
|
|
|
|
|
* @link https://github.com/PHPOffice/PHPWord
|
|
|
|
|
* @copyright 2014 PHPWord
|
|
|
|
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
|
|
|
|
*/
|
|
|
|
|
|
2014-03-23 11:59:22 -04:00
|
|
|
namespace PhpOffice\PhpWord\Tests\Style;
|
2014-03-10 03:20:24 +07:00
|
|
|
|
2014-03-22 10:06:08 +04:00
|
|
|
use PhpOffice\PhpWord\PhpWord;
|
2014-03-19 11:04:48 +04:00
|
|
|
use PhpOffice\PhpWord\Style\Tab;
|
2014-03-23 12:37:31 -04:00
|
|
|
use PhpOffice\PhpWord\Tests\TestHelperDOCX;
|
2014-03-10 03:20:24 +07:00
|
|
|
|
|
|
|
|
/**
|
2014-03-27 23:55:06 +07:00
|
|
|
* Test class for PhpOffice\PhpWord\Style\Tab
|
|
|
|
|
*
|
|
|
|
|
* @coversDefaultClass \PhpOffice\PhpWord\Style\Tab
|
2014-03-10 03:20:24 +07:00
|
|
|
* @runTestsInSeparateProcesses
|
|
|
|
|
*/
|
|
|
|
|
class TabsTest extends \PHPUnit_Framework_TestCase
|
|
|
|
|
{
|
|
|
|
|
/**
|
2014-03-12 09:25:21 -04:00
|
|
|
* Executed before each method of the class
|
|
|
|
|
*/
|
2014-03-10 03:20:24 +07:00
|
|
|
public function tearDown()
|
|
|
|
|
{
|
|
|
|
|
TestHelperDOCX::clear();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Test if the tabs has been created properly
|
|
|
|
|
*/
|
|
|
|
|
public function testTabsStyle()
|
|
|
|
|
{
|
2014-03-20 16:54:12 +04:00
|
|
|
$phpWord = new PhpWord();
|
|
|
|
|
$phpWord->addParagraphStyle('tabbed', array('tabs' => array(new Tab('left', 1440, 'dot'))));
|
|
|
|
|
$doc = TestHelperDOCX::getDocument($phpWord);
|
2014-03-10 03:20:24 +07:00
|
|
|
$file = 'word/styles.xml';
|
|
|
|
|
$path = '/w:styles/w:style[@w:styleId="tabbed"]/w:pPr/w:tabs/w:tab[1]';
|
|
|
|
|
$element = $doc->getElement($path, $file);
|
|
|
|
|
$this->assertEquals('left', $element->getAttribute('w:val'));
|
|
|
|
|
$this->assertEquals(1440, $element->getAttribute('w:pos'));
|
|
|
|
|
$this->assertEquals('dot', $element->getAttribute('w:leader'));
|
|
|
|
|
}
|
|
|
|
|
}
|