fix coverage
This commit is contained in:
parent
7a131d0ae1
commit
ea917c28da
|
|
@ -46,6 +46,7 @@ class Drawing
|
|||
if ($pValue == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return round($pValue / 9525);
|
||||
}
|
||||
|
||||
|
|
@ -71,7 +72,8 @@ class Drawing
|
|||
if ($pValue == 0) {
|
||||
return 0;
|
||||
}
|
||||
return ((($pValue * 1.333333333) / self::DPI_96) * 2.54);
|
||||
|
||||
return (($pValue * 1.333333333) / self::DPI_96) * 2.54;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -85,6 +87,7 @@ class Drawing
|
|||
if ($pValue == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return $pValue * 1.333333333;
|
||||
}
|
||||
|
||||
|
|
@ -97,7 +100,7 @@ class Drawing
|
|||
public static function pixelsToCentimeters($pValue = 0)
|
||||
{
|
||||
//return $pValue * 0.028;
|
||||
return (($pValue / self::DPI_96) * 2.54);
|
||||
return ($pValue / self::DPI_96) * 2.54;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -111,6 +114,7 @@ class Drawing
|
|||
if ($pValue == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return ($pValue / 2.54) * self::DPI_96;
|
||||
}
|
||||
|
||||
|
|
@ -136,13 +140,14 @@ class Drawing
|
|||
if ($pValue == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return round($pValue / 60000);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert centimeters width to twips
|
||||
*
|
||||
* @param integer $pValue
|
||||
* @param int $pValue
|
||||
* @return float
|
||||
*/
|
||||
public static function centimetersToTwips($pValue = 0)
|
||||
|
|
@ -150,13 +155,14 @@ class Drawing
|
|||
if ($pValue == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return $pValue * 566.928;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert twips width to centimeters
|
||||
*
|
||||
* @param integer $pValue
|
||||
* @param int $pValue
|
||||
* @return float
|
||||
*/
|
||||
public static function twipsToCentimeters($pValue = 0)
|
||||
|
|
@ -164,13 +170,14 @@ class Drawing
|
|||
if ($pValue == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return $pValue / 566.928;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert inches width to twips
|
||||
*
|
||||
* @param integer $pValue
|
||||
* @param int $pValue
|
||||
* @return float
|
||||
*/
|
||||
public static function inchesToTwips($pValue = 0)
|
||||
|
|
@ -178,13 +185,14 @@ class Drawing
|
|||
if ($pValue == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return $pValue * 1440;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert twips width to inches
|
||||
*
|
||||
* @param integer $pValue
|
||||
* @param int $pValue
|
||||
* @return float
|
||||
*/
|
||||
public static function twipsToInches($pValue = 0)
|
||||
|
|
@ -192,13 +200,14 @@ class Drawing
|
|||
if ($pValue == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return $pValue / 1440;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert twips width to pixels
|
||||
*
|
||||
* @param integer $pValue
|
||||
* @param int $pValue
|
||||
* @return float
|
||||
*/
|
||||
public static function twipsToPixels($pValue = 0)
|
||||
|
|
@ -206,6 +215,7 @@ class Drawing
|
|||
if ($pValue == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return round($pValue / 15.873984);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ class Text
|
|||
/**
|
||||
* Return a number formatted for being integrated in xml files
|
||||
* @param float $number
|
||||
* @param integer $decimals
|
||||
* @param int $decimals
|
||||
* @return string
|
||||
*/
|
||||
public static function numberFormat($number, $decimals)
|
||||
|
|
@ -79,24 +79,25 @@ class Text
|
|||
|
||||
/**
|
||||
* @param int $dec
|
||||
* @link http://stackoverflow.com/a/7153133/2235790
|
||||
* @see http://stackoverflow.com/a/7153133/2235790
|
||||
* @author velcrow
|
||||
* @return string
|
||||
*/
|
||||
public static function chr($dec)
|
||||
{
|
||||
if ($dec<=0x7F) {
|
||||
if ($dec <= 0x7F) {
|
||||
return chr($dec);
|
||||
}
|
||||
if ($dec<=0x7FF) {
|
||||
return chr(($dec>>6)+192).chr(($dec&63)+128);
|
||||
if ($dec <= 0x7FF) {
|
||||
return chr(($dec >> 6) + 192) . chr(($dec & 63) + 128);
|
||||
}
|
||||
if ($dec<=0xFFFF) {
|
||||
return chr(($dec>>12)+224).chr((($dec>>6)&63)+128).chr(($dec&63)+128);
|
||||
if ($dec <= 0xFFFF) {
|
||||
return chr(($dec >> 12) + 224) . chr((($dec >> 6) & 63) + 128) . chr(($dec & 63) + 128);
|
||||
}
|
||||
if ($dec<=0x1FFFFF) {
|
||||
return chr(($dec>>18)+240).chr((($dec>>12)&63)+128).chr((($dec>>6)&63)+128).chr(($dec&63)+128);
|
||||
if ($dec <= 0x1FFFFF) {
|
||||
return chr(($dec >> 18) + 240) . chr((($dec >> 12) & 63) + 128) . chr((($dec >> 6) & 63) + 128) . chr(($dec & 63) + 128);
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
|
|
@ -119,7 +120,7 @@ class Text
|
|||
* Check if a string contains UTF-8 data
|
||||
*
|
||||
* @param string $value
|
||||
* @return boolean
|
||||
* @return bool
|
||||
*/
|
||||
public static function isUTF8($value = '')
|
||||
{
|
||||
|
|
@ -161,7 +162,7 @@ class Text
|
|||
* @param string $text UTF8 text
|
||||
* @return array
|
||||
* @since 0.11.0
|
||||
* @link http://www.randomchaos.com/documents/?source=php_and_unicode
|
||||
* @see http://www.randomchaos.com/documents/?source=php_and_unicode
|
||||
*/
|
||||
public static function utf8ToUnicode($text)
|
||||
{
|
||||
|
|
@ -201,7 +202,7 @@ class Text
|
|||
* @param array $unicode
|
||||
* @return string
|
||||
* @since 0.11.0
|
||||
* @link http://www.randomchaos.com/documents/?source=php_and_unicode
|
||||
* @see http://www.randomchaos.com/documents/?source=php_and_unicode
|
||||
*/
|
||||
private static function unicodeToEntities($unicode)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -43,8 +43,8 @@ class XMLReader
|
|||
*
|
||||
* @param string $zipFile
|
||||
* @param string $xmlFile
|
||||
* @return \DOMDocument|false
|
||||
* @throws \Exception
|
||||
* @return \DOMDocument|false
|
||||
*/
|
||||
public function getDomFromZip($zipFile, $xmlFile)
|
||||
{
|
||||
|
|
@ -112,8 +112,8 @@ class XMLReader
|
|||
*
|
||||
* @param string $prefix The prefix
|
||||
* @param string $namespaceURI The URI of the namespace
|
||||
* @return bool true on success or false on failure
|
||||
* @throws \InvalidArgumentException If called before having loaded the DOM document
|
||||
* @return bool true on success or false on failure
|
||||
*/
|
||||
public function registerNamespace($prefix, $namespaceURI)
|
||||
{
|
||||
|
|
@ -123,6 +123,7 @@ class XMLReader
|
|||
if ($this->xpath === null) {
|
||||
$this->xpath = new \DOMXpath($this->dom);
|
||||
}
|
||||
|
||||
return $this->xpath->registerNamespace($prefix, $namespaceURI);
|
||||
}
|
||||
|
||||
|
|
@ -192,7 +193,7 @@ class XMLReader
|
|||
*
|
||||
* @param string $path
|
||||
* @param \DOMElement $contextNode
|
||||
* @return integer
|
||||
* @return int
|
||||
*/
|
||||
public function countElements($path, \DOMElement $contextNode = null)
|
||||
{
|
||||
|
|
@ -206,7 +207,7 @@ class XMLReader
|
|||
*
|
||||
* @param string $path
|
||||
* @param \DOMElement $contextNode
|
||||
* @return boolean
|
||||
* @return bool
|
||||
*/
|
||||
public function elementExists($path, \DOMElement $contextNode = null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ class XMLWriter extends \XMLWriter
|
|||
return;
|
||||
}
|
||||
if (PHP_OS != 'WINNT' && @unlink($this->tempFileName) === false) {
|
||||
throw new \Exception('The file '.$this->tempFileName.' could not be deleted.');
|
||||
throw new \Exception('The file ' . $this->tempFileName . ' could not be deleted.');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -104,10 +104,10 @@ class XMLWriter extends \XMLWriter
|
|||
}
|
||||
|
||||
$this->flush();
|
||||
|
||||
return file_get_contents($this->tempFileName);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Write simple element and attribute(s) block
|
||||
*
|
||||
|
|
@ -118,7 +118,6 @@ class XMLWriter extends \XMLWriter
|
|||
* @param string $element
|
||||
* @param string|array $attributes
|
||||
* @param string $value
|
||||
* @return void
|
||||
*/
|
||||
public function writeElementBlock($element, $attributes, $value = null)
|
||||
{
|
||||
|
|
@ -139,7 +138,6 @@ class XMLWriter extends \XMLWriter
|
|||
* @param string $element
|
||||
* @param string $attribute
|
||||
* @param mixed $value
|
||||
* @return void
|
||||
*/
|
||||
public function writeElementIf($condition, $element, $attribute = null, $value = null)
|
||||
{
|
||||
|
|
@ -160,7 +158,6 @@ class XMLWriter extends \XMLWriter
|
|||
* @param bool $condition
|
||||
* @param string $attribute
|
||||
* @param mixed $value
|
||||
* @return void
|
||||
*/
|
||||
public function writeAttributeIf($condition, $attribute, $value)
|
||||
{
|
||||
|
|
@ -179,6 +176,7 @@ class XMLWriter extends \XMLWriter
|
|||
if (is_float($value)) {
|
||||
$value = json_encode($value);
|
||||
}
|
||||
|
||||
return parent::writeAttribute($name, $value);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,13 +17,13 @@
|
|||
|
||||
namespace PhpOffice\PhpWord;
|
||||
|
||||
use PhpOffice\PhpWord\Shared\XMLWriter;
|
||||
use PhpOffice\PhpWord\Escaper\RegExp;
|
||||
use PhpOffice\PhpWord\Escaper\Xml;
|
||||
use PhpOffice\PhpWord\Exception\CopyFileException;
|
||||
use PhpOffice\PhpWord\Exception\CreateTemporaryFileException;
|
||||
use PhpOffice\PhpWord\Exception\Exception;
|
||||
use PhpOffice\PhpWord\Shared\Text;
|
||||
use PhpOffice\PhpWord\Shared\XMLWriter;
|
||||
use PhpOffice\PhpWord\Shared\ZipArchive;
|
||||
|
||||
class TemplateProcessor
|
||||
|
|
|
|||
|
|
@ -17,9 +17,9 @@
|
|||
|
||||
namespace PhpOffice\PhpWord\Writer\ODText\Element;
|
||||
|
||||
use PhpOffice\PhpWord\Shared\XMLWriter;
|
||||
use PhpOffice\PhpWord\Element\Row as RowElement;
|
||||
use PhpOffice\PhpWord\Element\Table as TableElement;
|
||||
use PhpOffice\PhpWord\Shared\XMLWriter;
|
||||
|
||||
/**
|
||||
* Table element writer
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@
|
|||
|
||||
namespace PhpOffice\PhpWord\Writer\ODText\Part;
|
||||
|
||||
use PhpOffice\PhpWord\Shared\XMLWriter;
|
||||
use PhpOffice\PhpWord\Settings;
|
||||
use PhpOffice\PhpWord\Shared\XMLWriter;
|
||||
use PhpOffice\PhpWord\Style;
|
||||
use PhpOffice\PhpWord\Style\Font;
|
||||
use PhpOffice\PhpWord\Writer\Word2007\Part\AbstractPart as Word2007AbstractPart;
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
|
||||
namespace PhpOffice\PhpWord\Writer\ODText\Part;
|
||||
|
||||
use PhpOffice\PhpWord\Shared\XMLWriter;
|
||||
use PhpOffice\PhpWord\Element\AbstractContainer;
|
||||
use PhpOffice\PhpWord\Element\Field;
|
||||
use PhpOffice\PhpWord\Element\Image;
|
||||
|
|
@ -26,6 +25,7 @@ use PhpOffice\PhpWord\Element\Text;
|
|||
use PhpOffice\PhpWord\Element\TextRun;
|
||||
use PhpOffice\PhpWord\Element\TrackChange;
|
||||
use PhpOffice\PhpWord\PhpWord;
|
||||
use PhpOffice\PhpWord\Shared\XMLWriter;
|
||||
use PhpOffice\PhpWord\Style;
|
||||
use PhpOffice\PhpWord\Style\Font;
|
||||
use PhpOffice\PhpWord\Style\Paragraph;
|
||||
|
|
|
|||
|
|
@ -17,9 +17,9 @@
|
|||
|
||||
namespace PhpOffice\PhpWord\Writer\ODText\Part;
|
||||
|
||||
use PhpOffice\PhpWord\Shared\XMLWriter;
|
||||
use PhpOffice\PhpWord\Settings;
|
||||
use PhpOffice\PhpWord\Shared\Converter;
|
||||
use PhpOffice\PhpWord\Shared\XMLWriter;
|
||||
use PhpOffice\PhpWord\Style;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -17,10 +17,10 @@
|
|||
|
||||
namespace PhpOffice\PhpWord\Writer\Word2007\Element;
|
||||
|
||||
use PhpOffice\PhpWord\Shared\XMLWriter;
|
||||
use PhpOffice\PhpWord\Element\AbstractElement as Element;
|
||||
use PhpOffice\PhpWord\Settings;
|
||||
use PhpOffice\PhpWord\Shared\Text as SharedText;
|
||||
use PhpOffice\PhpWord\Shared\XMLWriter;
|
||||
|
||||
/**
|
||||
* Abstract element writer
|
||||
|
|
|
|||
|
|
@ -17,10 +17,10 @@
|
|||
|
||||
namespace PhpOffice\PhpWord\Writer\Word2007\Element;
|
||||
|
||||
use PhpOffice\PhpWord\Shared\XMLWriter;
|
||||
use PhpOffice\PhpWord\Element\AbstractContainer as ContainerElement;
|
||||
use PhpOffice\PhpWord\Element\AbstractElement as Element;
|
||||
use PhpOffice\PhpWord\Element\TextBreak as TextBreakElement;
|
||||
use PhpOffice\PhpWord\Shared\XMLWriter;
|
||||
|
||||
/**
|
||||
* Container element writer (section, textrun, header, footnote, cell, etc.)
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@
|
|||
|
||||
namespace PhpOffice\PhpWord\Writer\Word2007\Element;
|
||||
|
||||
use PhpOffice\PhpWord\Shared\XMLWriter;
|
||||
use PhpOffice\PhpWord\Element\FormField as FormFieldElement;
|
||||
use PhpOffice\PhpWord\Shared\XMLWriter;
|
||||
|
||||
/**
|
||||
* FormField element writer
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@
|
|||
|
||||
namespace PhpOffice\PhpWord\Writer\Word2007\Element;
|
||||
|
||||
use PhpOffice\PhpWord\Shared\XMLWriter;
|
||||
use PhpOffice\PhpWord\Element\Image as ImageElement;
|
||||
use PhpOffice\PhpWord\Shared\XMLWriter;
|
||||
use PhpOffice\PhpWord\Style\Font as FontStyle;
|
||||
use PhpOffice\PhpWord\Style\Frame as FrameStyle;
|
||||
use PhpOffice\PhpWord\Writer\Word2007\Style\Font as FontStyleWriter;
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@
|
|||
|
||||
namespace PhpOffice\PhpWord\Writer\Word2007\Element;
|
||||
|
||||
use PhpOffice\PhpWord\Shared\XMLWriter;
|
||||
use PhpOffice\PhpWord\Element\SDT as SDTElement;
|
||||
use PhpOffice\PhpWord\Shared\XMLWriter;
|
||||
|
||||
/**
|
||||
* Structured document tag element writer
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@
|
|||
|
||||
namespace PhpOffice\PhpWord\Writer\Word2007\Element;
|
||||
|
||||
use PhpOffice\PhpWord\Shared\XMLWriter;
|
||||
use PhpOffice\PhpWord\Element\Shape as ShapeElement;
|
||||
use PhpOffice\PhpWord\Shared\XMLWriter;
|
||||
use PhpOffice\PhpWord\Style\Shape as ShapeStyle;
|
||||
use PhpOffice\PhpWord\Writer\Word2007\Style\Shape as ShapeStyleWriter;
|
||||
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@
|
|||
|
||||
namespace PhpOffice\PhpWord\Writer\Word2007\Element;
|
||||
|
||||
use PhpOffice\PhpWord\Shared\XMLWriter;
|
||||
use PhpOffice\PhpWord\Element\TOC as TOCElement;
|
||||
use PhpOffice\PhpWord\Shared\XMLWriter;
|
||||
use PhpOffice\PhpWord\Style\Font;
|
||||
use PhpOffice\PhpWord\Writer\Word2007\Style\Font as FontStyleWriter;
|
||||
use PhpOffice\PhpWord\Writer\Word2007\Style\Paragraph as ParagraphStyleWriter;
|
||||
|
|
|
|||
|
|
@ -17,10 +17,10 @@
|
|||
|
||||
namespace PhpOffice\PhpWord\Writer\Word2007\Element;
|
||||
|
||||
use PhpOffice\PhpWord\Shared\XMLWriter;
|
||||
use PhpOffice\PhpWord\Element\Cell as CellElement;
|
||||
use PhpOffice\PhpWord\Element\Row as RowElement;
|
||||
use PhpOffice\PhpWord\Element\Table as TableElement;
|
||||
use PhpOffice\PhpWord\Shared\XMLWriter;
|
||||
use PhpOffice\PhpWord\Style\Cell as CellStyle;
|
||||
use PhpOffice\PhpWord\Style\Row as RowStyle;
|
||||
use PhpOffice\PhpWord\Writer\Word2007\Style\Cell as CellStyleWriter;
|
||||
|
|
|
|||
|
|
@ -17,9 +17,9 @@
|
|||
|
||||
namespace PhpOffice\PhpWord\Writer\Word2007\Part;
|
||||
|
||||
use PhpOffice\PhpWord\Shared\XMLWriter;
|
||||
use PhpOffice\PhpWord\Exception\Exception;
|
||||
use PhpOffice\PhpWord\Settings;
|
||||
use PhpOffice\PhpWord\Shared\XMLWriter;
|
||||
use PhpOffice\PhpWord\Writer\AbstractWriter;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@
|
|||
|
||||
namespace PhpOffice\PhpWord\Writer\Word2007\Part;
|
||||
|
||||
use PhpOffice\PhpWord\Shared\XMLWriter;
|
||||
use PhpOffice\PhpWord\Element\Chart as ChartElement;
|
||||
use PhpOffice\PhpWord\Shared\XMLWriter;
|
||||
|
||||
/**
|
||||
* Word2007 chart part writer: word/charts/chartx.xml
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@
|
|||
|
||||
namespace PhpOffice\PhpWord\Writer\Word2007\Part;
|
||||
|
||||
use PhpOffice\PhpWord\Shared\XMLWriter;
|
||||
use PhpOffice\PhpWord\Element\Comment;
|
||||
use PhpOffice\PhpWord\Shared\XMLWriter;
|
||||
use PhpOffice\PhpWord\Writer\Word2007\Element\Container;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@
|
|||
|
||||
namespace PhpOffice\PhpWord\Writer\Word2007\Part;
|
||||
|
||||
use PhpOffice\PhpWord\Shared\XMLWriter;
|
||||
use PhpOffice\PhpWord\Element\Section;
|
||||
use PhpOffice\PhpWord\Shared\XMLWriter;
|
||||
use PhpOffice\PhpWord\Writer\Word2007\Element\Container;
|
||||
use PhpOffice\PhpWord\Writer\Word2007\Style\Section as SectionStyleWriter;
|
||||
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@
|
|||
|
||||
namespace PhpOffice\PhpWord\Writer\Word2007\Part;
|
||||
|
||||
use PhpOffice\PhpWord\Shared\XMLWriter;
|
||||
use PhpOffice\PhpWord\Element\Footnote;
|
||||
use PhpOffice\PhpWord\Shared\XMLWriter;
|
||||
use PhpOffice\PhpWord\Writer\Word2007\Element\Container;
|
||||
use PhpOffice\PhpWord\Writer\Word2007\Style\Paragraph as ParagraphStyleWriter;
|
||||
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@
|
|||
|
||||
namespace PhpOffice\PhpWord\Writer\Word2007\Part;
|
||||
|
||||
use PhpOffice\PhpWord\Shared\XMLWriter;
|
||||
use PhpOffice\PhpWord\Exception\Exception;
|
||||
use PhpOffice\PhpWord\Shared\XMLWriter;
|
||||
|
||||
/**
|
||||
* Word2007 main relationship writer: _rels/.rels
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@
|
|||
|
||||
namespace PhpOffice\PhpWord\Writer\Word2007\Style;
|
||||
|
||||
use PhpOffice\PhpWord\Shared\XMLWriter;
|
||||
use PhpOffice\PhpWord\Settings;
|
||||
use PhpOffice\PhpWord\Shared\XMLWriter;
|
||||
|
||||
/**
|
||||
* Style writer
|
||||
|
|
|
|||
|
|
@ -20,12 +20,10 @@ namespace PhpOffice\PhpWord\Shared;
|
|||
/**
|
||||
* Test class for PhpOffice\PhpWord\Shared\Drawing
|
||||
*
|
||||
* @coversDefaultClass PhpOffice\PhpWord\Shared\Drawing
|
||||
* @coversDefaultClass \PhpOffice\PhpWord\Shared\Drawing
|
||||
*/
|
||||
class DrawingTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
/**
|
||||
*/
|
||||
public function testDegreesAngle()
|
||||
{
|
||||
$value = rand(1, 100);
|
||||
|
|
@ -36,8 +34,6 @@ class DrawingTest extends \PHPUnit\Framework\TestCase
|
|||
$this->assertEquals(round($value / 60000), Drawing::angleToDegrees($value));
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public function testPixelsCentimeters()
|
||||
{
|
||||
$value = rand(1, 100);
|
||||
|
|
@ -48,32 +44,26 @@ class DrawingTest extends \PHPUnit\Framework\TestCase
|
|||
$this->assertEquals($value / 2.54 * Drawing::DPI_96, Drawing::centimetersToPixels($value));
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public function testPixelsEMU()
|
||||
{
|
||||
$value = rand(1, 100);
|
||||
|
||||
$this->assertEquals(0, Drawing::pixelsToEmu());
|
||||
$this->assertEquals(round($value*9525), Drawing::pixelsToEmu($value));
|
||||
$this->assertEquals(round($value * 9525), Drawing::pixelsToEmu($value));
|
||||
$this->assertEquals(0, Drawing::emuToPixels());
|
||||
$this->assertEquals(round($value/9525), Drawing::emuToPixels($value));
|
||||
$this->assertEquals(round($value / 9525), Drawing::emuToPixels($value));
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public function testPixelsPoints()
|
||||
{
|
||||
$value = rand(1, 100);
|
||||
|
||||
$this->assertEquals(0, Drawing::pixelsToPoints());
|
||||
$this->assertEquals($value*0.67777777, Drawing::pixelsToPoints($value));
|
||||
$this->assertEquals($value * 0.67777777, Drawing::pixelsToPoints($value));
|
||||
$this->assertEquals(0, Drawing::pointsToPixels());
|
||||
$this->assertEquals($value* 1.333333333, Drawing::pointsToPixels($value));
|
||||
$this->assertEquals($value * 1.333333333, Drawing::pointsToPixels($value));
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public function testPointsCentimeters()
|
||||
{
|
||||
$value = rand(1, 100);
|
||||
|
|
@ -82,8 +72,6 @@ class DrawingTest extends \PHPUnit\Framework\TestCase
|
|||
$this->assertEquals($value * 1.333333333 / Drawing::DPI_96 * 2.54, Drawing::pointsToCentimeters($value));
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public function testTwips()
|
||||
{
|
||||
$value = rand(1, 100);
|
||||
|
|
|
|||
|
|
@ -20,12 +20,10 @@ namespace PhpOffice\PhpWord\Shared;
|
|||
/**
|
||||
* Test class for Text
|
||||
*
|
||||
* @coversDefaultClass PhpOffice\PhpWord\Shared\Text
|
||||
* @coversDefaultClass \PhpOffice\PhpWord\Shared\Text
|
||||
*/
|
||||
class TextTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
/**
|
||||
*/
|
||||
public function testControlCharacters()
|
||||
{
|
||||
$this->assertEquals('', Text::controlCharacterPHP2OOXML());
|
||||
|
|
@ -33,7 +31,7 @@ class TextTest extends \PHPUnit\Framework\TestCase
|
|||
$this->assertEquals('àéîöù', Text::controlCharacterPHP2OOXML('àéîöù'));
|
||||
|
||||
$value = rand(0, 8);
|
||||
$this->assertEquals('_x'.sprintf('%04s', strtoupper(dechex($value))).'_', Text::controlCharacterPHP2OOXML(chr($value)));
|
||||
$this->assertEquals('_x' . sprintf('%04s', strtoupper(dechex($value))) . '_', Text::controlCharacterPHP2OOXML(chr($value)));
|
||||
|
||||
$this->assertEquals('', Text::controlCharacterOOXML2PHP(''));
|
||||
$this->assertEquals(chr(0x08), Text::controlCharacterOOXML2PHP('_x0008_'));
|
||||
|
|
@ -58,6 +56,7 @@ class TextTest extends \PHPUnit\Framework\TestCase
|
|||
$this->assertEquals('🌃', Text::chr(0x1F303));
|
||||
$this->assertEquals('', Text::chr(2097152));
|
||||
}
|
||||
|
||||
/**
|
||||
* Is UTF8
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ namespace PhpOffice\PhpWord\Shared;
|
|||
/**
|
||||
* Test class for XMLReader
|
||||
*
|
||||
* @coversDefaultClass PhpOffice\PhpWord\Shared\XMLReader
|
||||
* @coversDefaultClass \PhpOffice\PhpWord\Shared\XMLReader
|
||||
*/
|
||||
class XMLReaderTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
|
|
@ -57,7 +57,7 @@ class XMLReaderTest extends \PHPUnit\Framework\TestCase
|
|||
/**
|
||||
* Test that read from non existing archive throws exception
|
||||
*
|
||||
* @expectedException Exception
|
||||
* @expectedException \Exception
|
||||
*/
|
||||
public function testThrowsExceptionOnNonExistingArchive()
|
||||
{
|
||||
|
|
@ -124,7 +124,7 @@ class XMLReaderTest extends \PHPUnit\Framework\TestCase
|
|||
/**
|
||||
* Test that xpath fails if custom namespace is not registered
|
||||
*
|
||||
* @expectedException InvalidArgumentException
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testShouldThowExceptionIfTryingToRegisterNamespaceBeforeReadingDoc()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -24,8 +24,6 @@ namespace PhpOffice\PhpWord\Shared;
|
|||
*/
|
||||
class XMLWriterTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
/**
|
||||
*/
|
||||
public function testConstruct()
|
||||
{
|
||||
// Memory
|
||||
|
|
@ -33,14 +31,14 @@ class XMLWriterTest extends \PHPUnit\Framework\TestCase
|
|||
$object->startElement('element');
|
||||
$object->text('AAA');
|
||||
$object->endElement();
|
||||
$this->assertEquals('<element>AAA</element>'.chr(10), $object->getData());
|
||||
$this->assertEquals('<element>AAA</element>' . chr(10), $object->getData());
|
||||
|
||||
// Disk
|
||||
$object = new XMLWriter(XMLWriter::STORAGE_DISK);
|
||||
$object->startElement('element');
|
||||
$object->text('BBB');
|
||||
$object->endElement();
|
||||
$this->assertEquals('<element>BBB</element>'.chr(10), $object->getData());
|
||||
$this->assertEquals('<element>BBB</element>' . chr(10), $object->getData());
|
||||
}
|
||||
|
||||
public function testWriteAttribute()
|
||||
|
|
|
|||
|
|
@ -17,11 +17,11 @@
|
|||
|
||||
namespace PhpOffice\PhpWord\Writer\Word2007;
|
||||
|
||||
use PhpOffice\PhpWord\Shared\XMLWriter;
|
||||
use PhpOffice\PhpWord\Element\Comment;
|
||||
use PhpOffice\PhpWord\Element\TextRun;
|
||||
use PhpOffice\PhpWord\Element\TrackChange;
|
||||
use PhpOffice\PhpWord\PhpWord;
|
||||
use PhpOffice\PhpWord\Shared\XMLWriter;
|
||||
use PhpOffice\PhpWord\TestHelperDOCX;
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue