| @@ 40-75 (lines=36) @@ | ||
| 37 | /** |
|
| 38 | * @test |
|
| 39 | */ |
|
| 40 | public function testGetAction() |
|
| 41 | { |
|
| 42 | $content = <<<JSON |
|
| 43 | { |
|
| 44 | "data": { |
|
| 45 | "type": "employee", |
|
| 46 | "attributes": { |
|
| 47 | "company": "NilPortugues.com", |
|
| 48 | "surname": "Portugués", |
|
| 49 | "first_name": "Nil", |
|
| 50 | "email_address": "nilportugues@localhost", |
|
| 51 | "job_title": "Web Developer", |
|
| 52 | "business_phone": "(123)555-0100", |
|
| 53 | "home_phone": "(123)555-0102", |
|
| 54 | "mobile_phone": null, |
|
| 55 | "fax_number": "(123)555-0103", |
|
| 56 | "address": "Plaça Catalunya 1", |
|
| 57 | "city": "Barcelona", |
|
| 58 | "state_province": "Barcelona", |
|
| 59 | "zip_postal_code": "08028", |
|
| 60 | "country_region": "Spain", |
|
| 61 | "web_page": "http://nilportugues.com", |
|
| 62 | "notes": null, |
|
| 63 | "attachments": null |
|
| 64 | } |
|
| 65 | } |
|
| 66 | } |
|
| 67 | JSON; |
|
| 68 | ||
| 69 | $this->call('POST', 'http://localhost/api/v1/employees', json_decode($content, true), [], [], []); |
|
| 70 | ||
| 71 | $response = $this->call('GET', 'http://localhost/api/v1/employees/1'); |
|
| 72 | ||
| 73 | $this->assertEquals(200, $response->getStatusCode()); |
|
| 74 | $this->assertEquals('application/vnd.api+json', $response->headers->get('Content-type')); |
|
| 75 | } |
|
| 76 | ||
| 77 | /** |
|
| 78 | * @test |
|
| @@ 91-124 (lines=34) @@ | ||
| 88 | /** |
|
| 89 | * @test |
|
| 90 | */ |
|
| 91 | public function testPostAction() |
|
| 92 | { |
|
| 93 | $content = <<<JSON |
|
| 94 | { |
|
| 95 | "data": { |
|
| 96 | "type": "employee", |
|
| 97 | "attributes": { |
|
| 98 | "company": "NilPortugues.com", |
|
| 99 | "surname": "Portugués", |
|
| 100 | "first_name": "Nil", |
|
| 101 | "email_address": "nilportugues@localhost", |
|
| 102 | "job_title": "Web Developer", |
|
| 103 | "business_phone": "(123)555-0100", |
|
| 104 | "home_phone": "(123)555-0102", |
|
| 105 | "mobile_phone": null, |
|
| 106 | "fax_number": "(123)555-0103", |
|
| 107 | "address": "Plaça Catalunya 1", |
|
| 108 | "city": "Barcelona", |
|
| 109 | "state_province": "Barcelona", |
|
| 110 | "zip_postal_code": "08028", |
|
| 111 | "country_region": "Spain", |
|
| 112 | "web_page": "http://nilportugues.com", |
|
| 113 | "notes": null, |
|
| 114 | "attachments": null |
|
| 115 | } |
|
| 116 | } |
|
| 117 | } |
|
| 118 | JSON; |
|
| 119 | $response = $this->call('POST', 'http://localhost/api/v1/employees', json_decode($content, true), [], [], []); |
|
| 120 | ||
| 121 | $this->assertEquals(201, $response->getStatusCode()); |
|
| 122 | $this->assertEquals('application/vnd.api+json', $response->headers->get('Content-type')); |
|
| 123 | $this->assertEquals('http://localhost/api/v1/employees/1', $response->headers->get('Location')); |
|
| 124 | } |
|
| 125 | ||
| 126 | /** |
|
| 127 | * @test |
|