/** * @covers Soliant\SimpleFM\Adapter::execute * @todo Write more assertions for testExecute which exercise un-covered parser edge cases */ public function testExecute() { $file = dirname(__FILE__) . '/TestAssets/projectsampledata.xml'; $mockLoader = $this->object->getLoader(); $mockLoader->setTestXml(file_get_contents($file)); // return three records $result = $this->object->execute(); $this->assertEquals($result['count'], 3); // parsed with rowsbyrecid TRUE $this->object->setRowsbyrecid(TRUE); $result = $this->object->execute(); $taskNameField = $result['rows'][7676]['Tasks']['rows'][15001]['Task Name']; $this->assertEquals($taskNameField, 'Review mock ups'); // parsed with rowsbyrecid FALSE (the default behavior) $this->object->setRowsbyrecid(FALSE); $result = $this->object->execute(); $nonRepeatingField = $result['rows'][0]['Status']; $this->assertEquals($nonRepeatingField, '4'); $this->assertInternalType('string', $nonRepeatingField); $this->assertNotInternalType('array', $nonRepeatingField); $repeatingField = $result['rows'][0]['Repeating Field']; $this->assertInternalType('array', $repeatingField); $this->assertNotInternalType('string', $repeatingField); $taskNameField = $result['rows'][1]['Tasks']['rows'][2]['Task Name']; $this->assertEquals($taskNameField, 'Complete sketches'); $this->assertInternalType('string', $taskNameField); $this->assertNotInternalType('array', $taskNameField); $taskRepeatingField = $result['rows'][1]['Tasks']['rows'][2]['Repeating Field']; $this->assertInternalType('array', $taskRepeatingField); $this->assertNotInternalType('string', $taskRepeatingField); }