Skip to content

Commit

Permalink
Utilizing SharedString instead of String
Browse files Browse the repository at this point in the history
  • Loading branch information
publiux committed Jan 8, 2016
1 parent 70ba335 commit 83f53ec
Showing 1 changed file with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,51 +23,51 @@
* @coversDefaultClass \PhpOffice\PhpWord\Shared\String
* @runTestsInSeparateProcesses
*/
class StringTest extends \PHPUnit_Framework_TestCase
class SharedStringTest extends \PHPUnit_Framework_TestCase
{
/**
* Is UTF8
*/
public function testIsUTF8()
{
$this->assertTrue(String::isUTF8(''));
$this->assertTrue(String::isUTF8('éééé'));
$this->assertFalse(String::isUTF8(utf8_decode('éééé')));
$this->assertTrue(SharedString::isUTF8(''));
$this->assertTrue(SharedString::isUTF8('éééé'));
$this->assertFalse(SharedString::isUTF8(utf8_decode('éééé')));
}

/**
* OOXML to PHP control character
*/
public function testControlCharacterOOXML2PHP()
{
$this->assertEquals('', String::controlCharacterOOXML2PHP(''));
$this->assertEquals(chr(0x08), String::controlCharacterOOXML2PHP('_x0008_'));
$this->assertEquals('', SharedString::controlCharacterOOXML2PHP(''));
$this->assertEquals(chr(0x08), SharedString::controlCharacterOOXML2PHP('_x0008_'));
}

/**
* PHP to OOXML control character
*/
public function testControlCharacterPHP2OOXML()
{
$this->assertEquals('', String::controlCharacterPHP2OOXML(''));
$this->assertEquals('_x0008_', String::controlCharacterPHP2OOXML(chr(0x08)));
$this->assertEquals('', SharedString::controlCharacterPHP2OOXML(''));
$this->assertEquals('_x0008_', SharedString::controlCharacterPHP2OOXML(chr(0x08)));
}

/**
* Test unicode conversion
*/
public function testToUnicode()
{
$this->assertEquals('a', String::toUnicode('a'));
$this->assertEquals('\uc0{\u8364}', String::toUnicode(''));
$this->assertEquals('\uc0{\u233}', String::toUnicode('é'));
$this->assertEquals('a', SharedString::toUnicode('a'));
$this->assertEquals('\uc0{\u8364}', SharedString::toUnicode(''));
$this->assertEquals('\uc0{\u233}', SharedString::toUnicode('é'));
}

/**
* Test remove underscore prefix
*/
public function testRemoveUnderscorePrefix()
{
$this->assertEquals('item', String::removeUnderscorePrefix('_item'));
$this->assertEquals('item', SharedString::removeUnderscorePrefix('_item'));
}
}

0 comments on commit 83f53ec

Please sign in to comment.