@@ 78-99 (lines=22) @@ | ||
75 | $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); |
|
76 | } |
|
77 | ||
78 | public function testApiCreate() |
|
79 | { |
|
80 | $this->client->request( |
|
81 | 'POST', |
|
82 | '/v1/keys', |
|
83 | [], |
|
84 | [], |
|
85 | ['HTTP_CONTENT_TYPE' => 'application/json', 'CONTENT_TYPE' => 'application/json'], |
|
86 | json_encode(['key' => 'test_key', 'value' => 'test_value']) |
|
87 | ); |
|
88 | $this->assertTrue( |
|
89 | $this->client->getResponse()->headers->contains( |
|
90 | 'Content-Type', |
|
91 | 'application/json' |
|
92 | ) |
|
93 | ); |
|
94 | $this->assertEquals( |
|
95 | '{"key":"test_key","value":"test_value"}', |
|
96 | $this->client->getResponse()->getContent() |
|
97 | ); |
|
98 | $this->assertEquals(201, $this->client->getResponse()->getStatusCode()); |
|
99 | } |
|
100 | ||
101 | public function testApiCreateFormError() |
|
102 | { |
|
@@ 101-122 (lines=22) @@ | ||
98 | $this->assertEquals(201, $this->client->getResponse()->getStatusCode()); |
|
99 | } |
|
100 | ||
101 | public function testApiCreateFormError() |
|
102 | { |
|
103 | $this->client->request( |
|
104 | 'POST', |
|
105 | '/v1/keys', |
|
106 | [], |
|
107 | [], |
|
108 | ['HTTP_CONTENT_TYPE' => 'application/json', 'CONTENT_TYPE' => 'application/json'], |
|
109 | json_encode(['ke' => 'test_key', 'value' => 'test_value']) |
|
110 | ); |
|
111 | $this->assertTrue( |
|
112 | $this->client->getResponse()->headers->contains( |
|
113 | 'Content-Type', |
|
114 | 'application/json' |
|
115 | ) |
|
116 | ); |
|
117 | $this->assertEquals( |
|
118 | '{"code":400,"message":"Validation Failed","errors":{"errors":["This form should not contain extra fields."],"children":{"key":{},"value":{}}}}', |
|
119 | $this->client->getResponse()->getContent() |
|
120 | ); |
|
121 | $this->assertEquals(400, $this->client->getResponse()->getStatusCode()); |
|
122 | } |
|
123 | ||
124 | public function testApiPatch() |
|
125 | { |