diff --git a/tests/Client/CrmClientV2ArcadiaTest.php b/tests/Client/CrmClientV2ArcadiaTest.php index 3619b31..944c6db 100644 --- a/tests/Client/CrmClientV2ArcadiaTest.php +++ b/tests/Client/CrmClientV2ArcadiaTest.php @@ -2,8 +2,6 @@ namespace Tests\Client; -use DOMDocument; -use Illuminate\Support\Facades\File; use Illuminate\Support\Str; use LDC\LDCCRM\CrmApiV2; use LDC\LDCCRM\Enums\ArcadiaOrderType; @@ -190,105 +188,4 @@ class CrmClientV2ArcadiaTest extends CrmClientTester } } } - - /** - * Valdate xml generated files default. - * - * @return void - */ - public function testValidateGeneratedXmlDefault() - { - $fileFound = false; - - $files = File::allFiles(\storage_path('export/arcadia')); - - /** @var \Symfony\Component\Finder\SplFileInfo $file */ - foreach ($files as $file) { - if (\strpos($file->getFilename(), 'v2-order-000000023-default-') === 0) { - $fileFound = true; - - // Enable user error handling. - \libxml_use_internal_errors(true); - - $xml = new DOMDocument(); - $xml->load($file->getRealPath()); - - $this->assertTrue($xml->schemaValidate(\resource_path('documents/arcadia_default.xsd'))); - $this->libxmlDisplayErrors(); - } - } - $this->assertTrue($fileFound, 'Should have found a xml file to validate and pass validation'); - } - - /** - * Valdate xml generated files game. - * - * @return void - */ - public function testValidateGeneratedXmlGame() - { - $fileFound = false; - - $files = File::allFiles(\storage_path('export/arcadia')); - - /** @var \Symfony\Component\Finder\SplFileInfo $file */ - foreach ($files as $file) { - if (\strpos($file->getFilename(), 'v2-order-000000000-game') === 0) { - $fileFound = true; - - // Enable user error handling. - \libxml_use_internal_errors(true); - - $xml = new DOMDocument(); - $xml->load($file->getRealPath()); - - $this->assertTrue($xml->schemaValidate(\resource_path('documents/arcadia_game.xsd'))); - $this->libxmlDisplayErrors(); - } - } - $this->assertTrue($fileFound, 'Should have found a xml file to validate and pass validation'); - } - - /** - * Render a \LibXMLError - * - * @param \LibXMLError $error - * @return string - */ - private function libxmlDisplayError(\LibXMLError $error): string - { - $return = "
\n"; - switch ($error->level) { - case LIBXML_ERR_WARNING: - $return .= "Warning $error->code: "; - break; - case LIBXML_ERR_ERROR: - $return .= "Error $error->code: "; - break; - case LIBXML_ERR_FATAL: - $return .= "Fatal Error $error->code: "; - break; - } - $return .= trim($error->message); - if ($error->file) { - $return .= " in $error->file"; - } - $return .= " on line $error->line\n"; - - return $return; - } - - /** - * Display xml errors. - * - * @return void - */ - private function libxmlDisplayErrors() - { - $errors = libxml_get_errors(); - foreach ($errors as $error) { - print $this->libxmlDisplayError($error); - } - libxml_clear_errors(); - } }