Added support for mb_convert_encoding() instead of iconv()

See issue #109 at GitHub
This commit is contained in:
Christian Bläul
2018-01-21 15:02:25 +01:00
committed by Fonata
parent 5ea1d95f31
commit 8ae09c604b
2 changed files with 22 additions and 15 deletions

View File

@@ -65,7 +65,7 @@ class worthless_properties_Test extends PHPUnit\Framework\TestCase {
* @access public
*/
public function test_propertiesCount() {
$this->assertCount(27, $this->properties);
$this->assertCount(28, $this->properties);
}
/**
@@ -79,7 +79,7 @@ class worthless_properties_Test extends PHPUnit\Framework\TestCase {
*/
public function test_property_names() {
//set our expected properties name(s)
$names = array(
$expected_names = array(
'heading',
'fields',
'sort_by',
@@ -97,6 +97,7 @@ class worthless_properties_Test extends PHPUnit\Framework\TestCase {
'convert_encoding',
'input_encoding',
'output_encoding',
'use_mb_convert_encoding',
'linefeed',
'output_delimiter',
'output_filename',
@@ -109,19 +110,13 @@ class worthless_properties_Test extends PHPUnit\Framework\TestCase {
'data'
);
//find our real properties
$real_properties = [];
for ($a = 0; $a < count($this->properties); $a++) {
$real_properties[] = $this->properties[$a]->getName();
}
// Find our real properties
$real_properties = array_map(function (ReflectionProperty $property) {
return $property->getName();
}, $this->properties);
//lets make sure our expected matches the number of real properties
$this->assertCount(count($names), $this->properties);
//lets loop through our expected to make sure they exists
for ($a = 0; $a < count($names); $a++) {
$this->assertTrue(in_array($names[$a], $real_properties));
}
// Lets make sure our expected matches the number of real properties
$this->assertEquals($expected_names, $real_properties);
}
/**