PHP Classes

File: TestCases/OpenTestsXml.php

Recommend this page to a friend!
  Packages of Ramesh Narayan Jangid (Sharma)   Open Swoole Microservices   TestCases/OpenTestsXml.php   Download  
File: TestCases/OpenTestsXml.php
Role: Auxiliary script
Content type: text/plain
Description: Configuration script
Class: Open Swoole Microservices
Implement microservices using Open Swoole
Author: By
Last change: DocBlcck
Copyright
Date: 3 days ago
Size: 1,861 bytes
 

Contents

Class file image Download
<?php

/**
 * TestCases
 * php version 8.3
 *
 * @category TestCases
 * @package Openswoole-Microservices
 * @author Ramesh N. Jangid (Sharma) <polygon.co.in@gmail.com>
 * @copyright © 2026 Ramesh N. Jangid (Sharma)
 * @license MIT https://opensource.org/license/mit
 * @link https://github.com/polygoncoin/Openswoole-Microservices
 * @since Class available since Release 1.0.0
 */

namespace Microservices\TestCases;

use
Microservices\App\Web;

if (!
defined('GET')) {
   
define('GET', __DIR__ . DIRECTORY_SEPARATOR . 'GET');
   
define('POST', __DIR__ . DIRECTORY_SEPARATOR . 'POST');
   
define('PUT', __DIR__ . DIRECTORY_SEPARATOR . 'PUT');
   
define('PATCH', __DIR__ . DIRECTORY_SEPARATOR . 'PATCH');
   
define('DELETE', __DIR__ . DIRECTORY_SEPARATOR . 'DELETE');
}

// $apiVersion = 'X-API-Version: v1.0.0';
$cacheControl = 'Cache-Control: no-cache';
// $contentType = 'Content-Type: application/x-www-form-urlencoded; charset=utf-8';
// $contentType = 'Content-Type: multipart/form-data; charset=utf-8';
$contentType = 'Content-Type: text/plain; charset=utf-8';

$defaultHeaders = [];
// $defaultHeaders[] = $apiVersion;
$defaultHeaders[] = $cacheControl;

$response = [];

$homeURL = 'http://127.0.0.1:9501';

$params = [
   
'Paylaod' => [
       
'firstname' => 'Ramesh1',
       
'lastname' => 'Jangid',
       
'email' => 'ramesh@test.com',
       
'username' => 'test',
       
'password' => 'shames11',
       
'address' => [
           
'address' => 'A-203'
       
]
    ]
];

$payload = '<?xml version="1.0" encoding="UTF-8" ?>';
Web::genXmlPayload(params: $params, payload: $payload);

$response = Web::trigger(
   
homeURL: $homeURL,
   
method: 'POST',
   
route: '/registration-with-address'
       
. '&iRepresentation=XML&oRepresentation=XML',
   
header: $defaultHeaders,
   
payload: $payload
);

return
$response;