. */ namespace App\Tests\Services\Misc; use App\Services\Misc\MySQLDumpXMLConverter; use PHPUnit\Framework\TestCase; class MySQLDumpXMLConverterTest extends TestCase { public function testConvertMySQLDumpXMLDataToArrayStructure() { $service = new MySQLDumpXMLConverter(); //Load the test XML file $xml_string = file_get_contents(__DIR__.'/../../assets/partkeepr_import_test.xml'); $result = $service->convertMySQLDumpXMLDataToArrayStructure($xml_string); //Check that the result is an array $this->assertIsArray($result); //Must contain 36 tables $this->assertCount(50, $result); //Must have a table called "footprints" $this->assertArrayHasKey('footprint', $result); //Must have 36 entry in the "footprints" table $this->assertCount(36, $result['footprint']); $this->assertSame('1', $result['footprint'][0]['id']); $this->assertSame('CBGA-32', $result['footprint'][0]['name']); } }