<?php
require_once 'vendor/autoload.php';

// Simple test without full Laravel bootstrap
echo "Testing RmtoService...\n";

// Test parsing a SOAP response
$soapResponse = '<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
  <s:Body>
    <GetRmtoCurrentDateResponse xmlns="http://tempuri.org/">
      <GetRmtoCurrentDateResult>2026-04-24T23:38:20.4036469+03:30</GetRmtoCurrentDateResult>
    </GetRmtoCurrentDateResponse>
  </s:Body>
</s:Envelope>';

// Parse manually
$xmlObj = simplexml_load_string($soapResponse);
$xmlObj->registerXPathNamespace('tem', 'http://tempuri.org/');
$result = $xmlObj->xpath('//tem:GetRmtoCurrentDateResult');

if (isset($result[0])) {
    echo "✓ Date parsed successfully: " . (string) $result[0] . "\n";
} else {
    echo "✗ Failed to parse date\n";
}

// Test with service namespace
$xmlObj->registerXPathNamespace('s', 'http://schemas.xmlsoap.org/soap/envelope/');
$resultArray = json_decode(json_encode($xmlObj), true);
echo "✓ Full response parsed: " . json_encode($resultArray, JSON_UNESCAPED_UNICODE) . "\n";
