getCustomerOrNew(static::$info->hashcode); $arcadiaOrderMail = new ArcadiaMailDefault([ 'email' => static::$customer->email, 'firstname' => static::$info->firstname, 'lastname' => static::$info->lastname, 'phone' => static::$info->phone, 'address' => static::$info->address, 'address2' => static::$info->address2, 'city' => static::$info->city, 'postcode' => static::$info->postcode, 'operation' => 16, 'label_type_support' => 'Send Departaimants', 'order_date' => \date('Y/m/d H:i:s'), 'state_order' => ArcadiaOrderType::cb()->value, 'support_code' => 1, 'label_type_support' => 'Fond carte Aimanté', 'order_num' => 23, 'package_unit_weight' => 0, ]); $this->assertTrue($arcadiaOrderMail->send($customer)); } public function testArcadiaSendOrderGame() { $api = new CrmApiV2(); $customer = $api->getCustomerOrNew(static::$info->hashcode); $arcadiaOrderMail = new ArcadiaMailGame([ 'email' => static::$customer->email, 'firstname' => static::$info->firstname, 'lastname' => static::$info->lastname, 'phone' => static::$info->phone, 'address' => static::$info->address, 'address2' => static::$info->address2, 'city' => static::$info->city, 'postcode' => static::$info->postcode, 'operation' => 16, 'order_date' => date('Y/m/d H:i:s'), 'support_code' => 32, 'label_type_support' => 'Jeux Reghalal', 'code_unique' => \strtoupper(\str_replace('-', '', (string)Str::uuid())), 'code_on_pack' => '12365214587562' ]); $this->assertTrue($arcadiaOrderMail->send($customer)); } 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-game') === 0) { $fileFound = true; // Enable user error handling \libxml_use_internal_errors(true); $xml = new DOMDocument(); $xml->load($file->getRealPath()); if (!$xml->schemaValidate(\resource_path('documents/arcadia_game.xsd'))) { print 'DOMDocument::schemaValidate() Generated Errors!'; $this->libxmlDisplayErrors(); throw new \Exception('Could not validate xml file against xsd'); } } } $this->assertTrue($fileFound, 'Should have found a xml file to validate and pass validation'); } private function libxmlDisplayError($error) { $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; } private function libxmlDisplayErrors() { $errors = libxml_get_errors(); foreach ($errors as $error) { print $this->libxmlDisplayError($error); } libxml_clear_errors(); } }