CharsetValueConverterTest.php 657 B

12345678910111213141516171819202122
  1. <?php
  2. namespace Ddeboer\DataImport\Tests\ValueConverter;
  3. use Ddeboer\DataImport\ValueConverter\CharsetValueConverter;
  4. /**
  5. * @author Markus Bachmann <markus.bachmann@bachi.biz>
  6. */
  7. class CharsetValueConverterTest extends \PHPUnit_Framework_TestCase
  8. {
  9. public function testConvert()
  10. {
  11. $utf8 = utf8_encode('test');
  12. $converter = new CharsetValueConverter('UTF-8');
  13. $this->assertEquals($utf8, call_user_func($converter, $utf8));
  14. $value = iconv('UTF-8', 'UTF-16', $utf8);
  15. $converter = new CharsetValueConverter('UTF-8', 'UTF-16');
  16. $this->assertEquals($utf8, call_user_func($converter, $value));
  17. }
  18. }