assertEquals( $expected, $node->getData() ); } public function dataProvider() { return [ [ '', [], [ 'value' => '' ] ], [ 'kjdflkja dafkjlsdkfj', [], [ 'value' => 'kjdflkja dafkjlsdkfj' ] ], [ 'kjdflkjadafkjlsdkfj', [], [ 'value' => 'kjdflkjadafkjlsdkfj' ] ], ]; } /** * @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 ] ]; } }