PHPWord/tests/PhpWord/Element/TextBoxTest.php

71 lines
2.1 KiB
PHP
Raw Normal View History

2014-05-07 21:27:51 +02:00
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.
*
* PHPWord is free software distributed under the terms of the GNU Lesser
* General Public License version 3 as published by the Free Software Foundation.
*
* For the full copyright and license information, please read the LICENSE
* file that was distributed with this source code. For the full list of
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @see https://github.com/PHPOffice/PHPWord
* @copyright 2010-2017 PHPWord contributors
2014-05-07 21:27:51 +02:00
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
2015-11-15 13:33:05 +04:00
namespace PhpOffice\PhpWord\Element;
2014-05-07 21:27:51 +02:00
/**
* Test class for PhpOffice\PhpWord\Element\TextBox
*
* @coversDefaultClass \PhpOffice\PhpWord\Element\TextBox
* @runTestsInSeparateProcesses
*/
class TextBoxTest extends \PHPUnit_Framework_TestCase
{
/**
* Create new instance
*/
public function testConstruct()
{
$oTextBox = new TextBox();
2014-05-07 21:27:51 +02:00
$this->assertInstanceOf('PhpOffice\\PhpWord\\Element\\TextBox', $oTextBox);
$this->assertNull($oTextBox->getStyle());
2014-05-07 21:27:51 +02:00
}
/**
* Get style name
*/
public function testStyleText()
{
$oTextBox = new TextBox('textBoxStyle');
$this->assertEquals('textBoxStyle', $oTextBox->getStyle());
2014-05-07 21:27:51 +02:00
}
2014-05-07 21:27:51 +02:00
/**
* Get style array
*/
public function testStyleArray()
{
$oTextBox = new TextBox(
array(
'width' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(4.5),
'height' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(17.5),
2014-05-07 21:27:51 +02:00
'positioning' => 'absolute',
'marginLeft' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(15.4),
'marginTop' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(9.9),
'stroke' => 0,
2014-05-07 21:27:51 +02:00
'innerMargin' => 0,
'borderSize' => 1,
'borderColor' => '',
2014-05-07 21:27:51 +02:00
)
);
2014-05-07 21:27:51 +02:00
$this->assertInstanceOf('PhpOffice\\PhpWord\\Style\\TextBox', $oTextBox->getStyle());
}
}