24 private $testString =
"äöüßÄÖÜ";
29 protected function setUp()
31 $detected = mb_detect_encoding($this->testString);
32 assertThat($detected, is(
"UTF-8"));
36 public function testUtf8IsKept()
38 assertThat( $this->converter->convert($this->testString), is($this->testString));
41 public function testLatin15IsConverted()
43 $encodedString = iconv(
"UTF-8",
"ISO-8859-15", $this->testString);
44 assertThat( $this->converter->convert($encodedString), is($this->testString));
47 public function testMixedEncodingIsConvertedAndCoercedToUtf8()
49 $inputString = $this->testString;
50 $inputString .= iconv(
"UTF-8",
"ISO-8859-15", $this->testString);
51 $outputString = $this->converter->convert($inputString);
52 assertThat( $outputString, endsWith($this->testString));
53 assertThat( strlen($outputString), is(greaterThan(2 * strlen($this->testString))));
56 public function testMixedEncodingStartingWithLatin1IsConvertedAndCoercedToUtf8()
58 $inputString = iconv(
"UTF-8",
"ISO-8859-15", $this->testString);
59 $inputString .= $this->testString;
60 $outputString = $this->converter->convert($inputString);
61 assertThat( $outputString, startsWith($this->testString));
62 assertThat( strlen($outputString), is(greaterThan(2 * strlen($this->testString))));