PHPWord/tests/PhpWord/Tests/Shared/StringTest.php

50 lines
1.2 KiB
PHP
Raw Normal View History

<?php
2014-03-27 23:55:06 +07:00
/**
* PHPWord
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2014 PHPWord
2014-05-04 21:03:28 +04:00
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
2014-03-27 23:55:06 +07:00
*/
namespace PhpOffice\PhpWord\Tests\Shared;
use PhpOffice\PhpWord\Shared\String;
/**
2014-03-27 23:55:06 +07:00
* Test class for PhpOffice\PhpWord\Shared\String
*
* @coversDefaultClass \PhpOffice\PhpWord\Shared\String
* @runTestsInSeparateProcesses
*/
class StringTest extends \PHPUnit_Framework_TestCase
{
2014-03-30 14:15:23 +07:00
/**
* Is UTF8
*/
2014-03-14 20:36:09 +01:00
public function testIsUTF8()
{
$this->assertTrue(String::isUTF8(''));
$this->assertTrue(String::isUTF8('éééé'));
$this->assertFalse(String::isUTF8(utf8_decode('éééé')));
}
2014-03-30 14:15:23 +07:00
/**
* OOXML to PHP control character
*/
public function testControlCharacterOOXML2PHP()
{
$this->assertEquals('', String::controlCharacterOOXML2PHP(''));
$this->assertEquals(chr(0x08), String::controlCharacterOOXML2PHP('_x0008_'));
}
2014-03-14 20:36:09 +01:00
2014-03-30 14:15:23 +07:00
/**
* PHP to OOXML control character
*/
public function testControlCharacterPHP2OOXML()
{
$this->assertEquals('', String::controlCharacterPHP2OOXML(''));
$this->assertEquals('_x0008_', String::controlCharacterPHP2OOXML(chr(0x08)));
}
}