@@ -15,23 +15,26 @@ public function setUp()
1515 public function test_encoding_iso88591_as_UTF8 ()
1616 {
1717 $ encoding = new FileEncoding ();
18- $ result = $ encoding ->encodeFile ('iso88591.txt ' , 'UTF-8 ' , 'UTF-8,ISO-8859-1,WINDOWS-1252 ' );
19- $ this ->assertTrue ($ result );
18+ $ this ->assertTrue ($ encoding ->detectEncoding ('iso88591.txt ' , 'UTF-8,ISO-8859-1,WINDOWS-1252 ' ) == 'ISO-8859-1 ' );
19+ $ this ->assertTrue ($ encoding ->encodeFile ('iso88591.txt ' , 'UTF-8 ' , 'UTF-8,ISO-8859-1,WINDOWS-1252 ' ));
20+ $ this ->assertTrue ($ encoding ->checkEncoding ('iso88591.txt ' ,'UTF-8 ' ));
2021 }
2122
2223 /** @test */
2324 public function test_encoding_UTF8_as_UTF8 ()
2425 {
2526 $ encoding = new FileEncoding ();
26- $ result = $ encoding ->encodeFile ('utf8.txt ' );
27- $ this ->assertTrue ($ result );
27+ $ this ->assertTrue ($ encoding ->detectEncoding ('utf8.txt ' , 'UTF-8,ISO-8859-1,WINDOWS-1252 ' ) == 'UTF-8 ' );
28+ $ this ->assertTrue ($ result = $ encoding ->encodeFile ('utf8.txt ' ));
29+ $ this ->assertTrue ($ encoding ->checkEncoding ('utf8.txt ' ,'UTF-8 ' ));
2830 }
2931
3032 /** @test */
3133 public function test_encoding_file_not_exists ()
3234 {
3335 $ encoding = new FileEncoding ();
34- $ result = $ encoding ->encodeFile ('test.txt ' );
35- $ this ->assertFalse ($ result );
36+ $ this ->assertFalse ($ encoding ->detectEncoding ('test.txt ' , 'UTF-8,ISO-8859-1,WINDOWS-1252 ' ) == 'UTF-8 ' );
37+ $ this ->assertFalse ($ result = $ encoding ->encodeFile ('test.txt ' ));
38+ $ this ->assertFalse ($ encoding ->checkEncoding ('test.txt ' ,'UTF-8 ' ));
3639 }
3740}
0 commit comments