@@ 29-45 (lines=17) @@ | ||
26 | $response = $client->getResponse(); |
|
27 | } |
|
28 | ||
29 | public function testRoutingApiParametersWithValidation() |
|
30 | { |
|
31 | $client = static::createClient(); |
|
32 | ||
33 | $client->request('POST', '/example/api/ws-route-validation?page=test&max=20&sort=address', array('created_at' => '08/11/2014')); |
|
34 | $response = $client->getResponse(); |
|
35 | ||
36 | $this->assertEquals(400, $response->getStatusCode()); |
|
37 | ||
38 | $this->assertEquals(array( |
|
39 | 'errors' => array( |
|
40 | 'page' => 'This value should be a valid number.', |
|
41 | 'sort' => 'The value you selected is not a valid choice.', |
|
42 | 'created_at' => 'This value is not a valid date.', |
|
43 | ), |
|
44 | ), json_decode($response->getContent(), true)); |
|
45 | } |
|
46 | ||
47 | public function testAnnotationsApiParameters() |
|
48 | { |
|
@@ 47-59 (lines=13) @@ | ||
44 | ), json_decode($response->getContent(), true)); |
|
45 | } |
|
46 | ||
47 | public function testAnnotationsApiParameters() |
|
48 | { |
|
49 | $client = static::createClient(); |
|
50 | ||
51 | $client->request('POST', '/example/api/ws-annotations?page=1&max=20&sort=name', array('created_at' => '2014-01-01')); |
|
52 | $response = $client->getResponse(); |
|
53 | $this->assertEquals(array( |
|
54 | 'page' => '1', |
|
55 | 'max' => '20', |
|
56 | 'sort' => 'name', |
|
57 | 'created_at' => '2014-01-01', |
|
58 | ), json_decode($response->getContent(), true)); |
|
59 | } |
|
60 | ||
61 | public function testAnnotationsApiParametersWithValidation() |
|
62 | { |
|
@@ 61-77 (lines=17) @@ | ||
58 | ), json_decode($response->getContent(), true)); |
|
59 | } |
|
60 | ||
61 | public function testAnnotationsApiParametersWithValidation() |
|
62 | { |
|
63 | $client = static::createClient(); |
|
64 | ||
65 | $client->request('POST', '/example/api/ws-annotations-validation?page=test&max=20&sort=address', array('created_at' => '08/11/2014')); |
|
66 | $response = $client->getResponse(); |
|
67 | ||
68 | $this->assertEquals(400, $response->getStatusCode()); |
|
69 | ||
70 | $this->assertEquals(array( |
|
71 | 'errors' => array( |
|
72 | 'page' => 'This value should be a valid number.', |
|
73 | 'sort' => 'The value you selected is not a valid choice.', |
|
74 | 'created_at' => 'This value is not a valid date.', |
|
75 | ), |
|
76 | ), json_decode($response->getContent(), true)); |
|
77 | } |
|
78 | ||
79 | public function testAnnotationsApiParametersWithValidationXml() |
|
80 | { |
|
@@ 100-112 (lines=13) @@ | ||
97 | ); |
|
98 | } |
|
99 | ||
100 | public function testAnnotationsAsParam() |
|
101 | { |
|
102 | $client = static::createClient(); |
|
103 | ||
104 | $client->request('POST', '/example/api/ws-annotations-as?page=1&max=20&sort=name', array('created_at' => '2014-01-01')); |
|
105 | $response = $client->getResponse(); |
|
106 | $this->assertEquals(array( |
|
107 | 'page' => '1', |
|
108 | 'max' => '20', |
|
109 | 'sort' => 'name', |
|
110 | 'created_at' => '2014-01-01', |
|
111 | ), json_decode($response->getContent(), true)); |
|
112 | } |
|
113 | ||
114 | public function testRoutinAsParam() |
|
115 | { |
|
@@ 114-126 (lines=13) @@ | ||
111 | ), json_decode($response->getContent(), true)); |
|
112 | } |
|
113 | ||
114 | public function testRoutinAsParam() |
|
115 | { |
|
116 | $client = static::createClient(); |
|
117 | ||
118 | $client->request('POST', '/example/api/ws-routing-as?page=1&max=20&sort=name', array('created_at' => '2014-01-01')); |
|
119 | $response = $client->getResponse(); |
|
120 | $this->assertEquals(array( |
|
121 | 'page' => '1', |
|
122 | 'max' => '20', |
|
123 | 'sort' => 'name', |
|
124 | 'created_at' => '2014-01-01', |
|
125 | ), json_decode($response->getContent(), true)); |
|
126 | } |
|
127 | ||
128 | public function testErrorsWithSubCollections() |
|
129 | { |