Remove arcadia test that validates files on server
This commit is contained in:
parent
1b9acc61ca
commit
85228f1bb6
1 changed files with 0 additions and 103 deletions
|
|
@ -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 = "<br/>\n";
|
||||
switch ($error->level) {
|
||||
case LIBXML_ERR_WARNING:
|
||||
$return .= "<b>Warning $error->code</b>: ";
|
||||
break;
|
||||
case LIBXML_ERR_ERROR:
|
||||
$return .= "<b>Error $error->code</b>: ";
|
||||
break;
|
||||
case LIBXML_ERR_FATAL:
|
||||
$return .= "<b>Fatal Error $error->code</b>: ";
|
||||
break;
|
||||
}
|
||||
$return .= trim($error->message);
|
||||
if ($error->file) {
|
||||
$return .= " in <b>$error->file</b>";
|
||||
}
|
||||
$return .= " on line <b>$error->line</b>\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();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue