Skip to content
This repository was archived by the owner on Feb 14, 2023. It is now read-only.

Commit 5124268

Browse files
author
Andrey Helldar
committed
Added tests
1 parent dc5ee10 commit 5124268

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

tests/ResponseServiceTest.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,26 @@ public function testDataWith()
6262
]),
6363
api_response('ok', 400, [], ['foo' => 'bar'])->getContent()
6464
);
65+
66+
$this->assertEquals(
67+
json_encode(['data' => [], 'foo' => 'bar', 'baz' => 'baq']),
68+
api_response([], 200, [], ['foo' => 'bar', 'baz' => 'baq'])->getContent()
69+
);
70+
71+
$this->assertEquals(
72+
json_encode(['data' => ['foo' => 'foo', 'bar' => 'bar'], 'foo' => 'bar', 'baz' => 'baq']),
73+
api_response([], 200, [], ['data' => ['foo' => 'foo', 'bar' => 'bar'], 'foo' => 'bar', 'baz' => 'baq'])->getContent()
74+
);
75+
76+
$this->assertEquals(
77+
json_encode(['error' => ['code' => 400, 'data' => []], 'foo' => 'bar', 'baz' => 'baq']),
78+
api_response([], 400, [], ['foo' => 'bar', 'baz' => 'baq'])->getContent()
79+
);
80+
81+
$this->assertEquals(
82+
json_encode(['error' => ['code' => 400, 'data' => []], 'data' => ['foo' => 'foo', 'bar' => 'bar'], 'foo' => 'bar', 'baz' => 'baq']),
83+
api_response([], 400, [], ['data' => ['foo' => 'foo', 'bar' => 'bar'], 'foo' => 'bar', 'baz' => 'baq'])->getContent()
84+
);
6585
}
6686

6787
public function testNumber()

0 commit comments

Comments
 (0)