-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_boolean_xml.php
More file actions
44 lines (35 loc) · 1.1 KB
/
Copy pathtest_boolean_xml.php
File metadata and controls
44 lines (35 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
require_once 'vendor/autoload.php';
use App\Traits\MultiFormatResponse;
// Create a test class that uses the trait
class TestMultiFormatResponse
{
use MultiFormatResponse;
// Public wrapper for testing
public function testXmlResponse($data)
{
return $this->xmlResponse($data);
}
}
$test = new TestMultiFormatResponse();
// Test data with boolean values (similar to pagination response)
$data = [
'data' => ['item1', 'item2', 'item3'],
'pagination' => [
'current_page' => 1,
'per_page' => 50,
'total' => 43,
'last_page' => 1,
'from' => 1,
'to' => 43,
'has_more_pages' => false,
'has_previous_pages' => false,
]
];
echo "Testing XML response with boolean values:\n";
echo "==========================================\n\n";
$response = $test->testXmlResponse($data);
echo $response->getContent();
echo "\n\nExpected behavior:\n";
echo "- has_more_pages should show as <has_more_pages>false</has_more_pages>\n";
echo "- has_previous_pages should show as <has_previous_pages>false</has_previous_pages>\n";