assertEquals( $expected, $node->getData() );
}
public function dataProvider() {
return [
[
'',
[ 'value' => '' ]
],
[
'kjdflkja dafkjlsdkfj',
[ 'value' => 'kjdflkja dafkjlsdkfj' ]
],
[
'kjdflkja[dafkjlsdkfj]',
[ 'value' => 'kjdflkja[dafkjlsdkfj]' ]
]
];
}
/**
* @dataProvider isEmptyDataProvider
*/
public function testIsEmpty( $string, $expectedOutput ) {
$xml = simplexml_load_string( $string );
$node = new PortableInfobox\Parser\Nodes\NodeNavigation( $xml, [] );
$data = $node->getData();
$this->assertTrue( $node->isEmpty( $data ) == $expectedOutput );
}
public function isEmptyDataProvider() {
return [
[
'string' => 'goodnight',
'expectedOutput' => false
],
[
'string' => 'null',
'expectedOutput' => false
],
[
'string' => '0',
'expectedOutput' => false
],
[
'string' => '\'0\'',
'expectedOutput' => false
],
[
'string' => '',
'expectedOutput' => true
],
[
'string' => ' ',
'expectedOutput' => true
]
];
}
}