Skip to content

Commit 2030c6d

Browse files
committed
FIX test
1 parent 86085bf commit 2030c6d

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

tests/FileEncodingTest.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -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
}

tests/files/test_iso-8859-1.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Texto de ejemplo con acentos �����������

tests/files/test_utf8.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-

1+
Example file test

0 commit comments

Comments
 (0)