diff --git a/src/Tenant/urls.php b/src/Tenant/urls.php index 09aa8bc..19edc8f 100644 --- a/src/Tenant/urls.php +++ b/src/Tenant/urls.php @@ -21,14 +21,14 @@ * Tenant */ array( - 'regex' => '#^/current$#', + 'regex' => '#^/tenant/current$#', 'model' => 'Tenant_Views', 'method' => 'current', 'http-method' => 'GET', 'precond' => array() ), array( - 'regex' => '#^/current$#', + 'regex' => '#^/tenant/current$#', 'model' => 'Tenant_Views', 'method' => 'update', 'http-method' => 'POST', @@ -37,7 +37,7 @@ ) ), array( - 'regex' => '#^/current$#', + 'regex' => '#^/tenant/current$#', 'model' => 'Tenant_Views', 'method' => 'delete', 'http-method' => 'DELETE', @@ -49,7 +49,7 @@ * Ticket */ array( - 'regex' => '#^/current/ticket/find$#', + 'regex' => '#^/ticket/find$#', 'model' => 'Pluf_Views', 'method' => 'findObject', 'http-method' => 'GET', @@ -82,7 +82,7 @@ ) ), array( - 'regex' => '#^/current/ticket/new$#', + 'regex' => '#^/ticket/new$#', 'model' => 'Pluf_Views', 'method' => 'createObject', 'http-method' => 'POST', @@ -94,7 +94,7 @@ ) ), array( - 'regex' => '#^/current/ticket/(?P\d+)$#', + 'regex' => '#^/ticket/(?P\d+)$#', 'model' => 'Pluf_Views', 'method' => 'getObject', 'http-method' => 'GET', @@ -106,7 +106,7 @@ ) ), array( - 'regex' => '#^/current/ticket/(?P\d+)$#', + 'regex' => '#^/ticket/(?P\d+)$#', 'model' => 'Pluf_Views', 'method' => 'updateObject', 'http-method' => 'POST', @@ -118,7 +118,7 @@ ) ), array( - 'regex' => '#^/current/ticket/(?P\d+)$#', + 'regex' => '#^/ticket/(?P\d+)$#', 'model' => 'Pluf_Views', 'method' => 'deleteObject', 'http-method' => 'DELETE', @@ -133,7 +133,7 @@ * Comments of ticket */ array( - 'regex' => '#^/current/ticket/(?P\d+)/comment/find$#', + 'regex' => '#^/ticket/(?P\d+)/comment/find$#', 'model' => 'Pluf_Views', 'method' => 'findManyToOne', 'http-method' => 'GET', @@ -168,7 +168,7 @@ ) ), array( - 'regex' => '#^/current/ticket/(?P\d+)/comment/new$#', + 'regex' => '#^/ticket/(?P\d+)/comment/new$#', 'model' => 'Pluf_Views', 'method' => 'createManyToOne', 'http-method' => 'POST', @@ -182,7 +182,7 @@ ) ), array( - 'regex' => '#^/current/ticket/(?P\d+)/comment/(?P\d+)$#', + 'regex' => '#^/ticket/(?P\d+)/comment/(?P\d+)$#', 'model' => 'Pluf_Views', 'method' => 'getManyToOne', 'http-method' => 'GET', @@ -196,7 +196,7 @@ ) ), array( - 'regex' => '#^/current/ticket/(?P\d+)/comment/(?P\d+)$#', + 'regex' => '#^/ticket/(?P\d+)/comment/(?P\d+)$#', 'model' => 'Pluf_Views', 'method' => 'updateManyToOne', 'http-method' => 'POST', @@ -210,7 +210,7 @@ ) ), array( - 'regex' => '#^/current/ticket/(?P\d+)/comment/(?P\d+)$#', + 'regex' => '#^/ticket/(?P\d+)/comment/(?P\d+)$#', 'model' => 'Pluf_Views', 'method' => 'deleteManyToOne', 'http-method' => 'DELETE', @@ -228,7 +228,7 @@ * invoices */ array( - 'regex' => '#^/current/invoice/find$#', + 'regex' => '#^/invoice/find$#', 'model' => 'Pluf_Views', 'method' => 'findObject', 'http-method' => 'GET', @@ -261,7 +261,7 @@ ) ), array( - 'regex' => '#^/current/invoice/(?P\d+)$#', + 'regex' => '#^/invoice/(?P\d+)$#', 'model' => 'Pluf_Views', 'method' => 'getObject', 'http-method' => 'GET', diff --git a/tests/Tenant_REST/InvoicesTest.php b/tests/Tenant_REST/InvoicesTest.php index d5bd3ac..127fe4d 100644 --- a/tests/Tenant_REST/InvoicesTest.php +++ b/tests/Tenant_REST/InvoicesTest.php @@ -112,7 +112,7 @@ public function testFindInvoices() Test_Assert::assertResponseStatusCode($response, 200, 'Fail to login'); // find - $response = $client->get('/api/tenant/current/invoice/find'); + $response = $client->get('/api/tenant/invoice/find'); Test_Assert::assertResponseNotNull($response, 'Find result is empty'); Test_Assert::assertResponseStatusCode($response, 200, 'Find status code is not 200'); Test_Assert::assertResponsePaginateList($response, 'Find result is not JSON paginated list'); @@ -156,7 +156,7 @@ public function testFindInvoicesNonEmpty() $i->create(); // find - $response = $client->get('/api/tenant/current/invoice/find'); + $response = $client->get('/api/tenant/invoice/find'); Test_Assert::assertResponseNotNull($response, 'Find result is empty'); Test_Assert::assertResponseStatusCode($response, 200, 'Find status code is not 200'); Test_Assert::assertResponsePaginateList($response, 'Find result is not JSON paginated list'); @@ -203,7 +203,7 @@ public function testGetInvoice() $i->create(); // find - $response = $client->get('/api/tenant/current/invoice/'. $i->id); + $response = $client->get('/api/tenant/invoice/'. $i->id); Test_Assert::assertResponseNotNull($response); Test_Assert::assertResponseStatusCode($response, 200); Test_Assert::assertResponseNotAnonymousModel($response, 'Invoice not foudn'); diff --git a/tests/Tenant_REST/TenantTest.php b/tests/Tenant_REST/TenantTest.php index 58b1c6d..3a0c902 100755 --- a/tests/Tenant_REST/TenantTest.php +++ b/tests/Tenant_REST/TenantTest.php @@ -100,7 +100,7 @@ public function testDefaultTenant() 'sub' => include 'Tenant/urls.php' ) )); - $response = $client->get('/api/tenant/current'); + $response = $client->get('/api/tenant/tenant/current'); $this->assertNotNull($response); $this->assertEquals($response->status_code, 200); } diff --git a/tests/Tenant_REST/TicketCommentTest.php b/tests/Tenant_REST/TicketCommentTest.php index 322ba79..bc932b5 100644 --- a/tests/Tenant_REST/TicketCommentTest.php +++ b/tests/Tenant_REST/TicketCommentTest.php @@ -126,7 +126,7 @@ public function testFindTikcetComments() $t->create(); // find comments - $response = $client->get('/api/tenant/current/ticket/' . $t->id . '/comment/find'); + $response = $client->get('/api/tenant/ticket/' . $t->id . '/comment/find'); Test_Assert::assertResponseNotNull($response, 'Find result is empty'); Test_Assert::assertResponseStatusCode($response, 200, 'Find status code is not 200'); Test_Assert::assertResponsePaginateList($response, 'Find result is not JSON paginated list'); @@ -183,7 +183,7 @@ public function testFindTikcetCommentSNotEmpty() $c->create(); // find comments - $response = $client->get('/api/tenant/current/ticket/' . $t->id . '/comment/find'); + $response = $client->get('/api/tenant/ticket/' . $t->id . '/comment/find'); Test_Assert::assertResponseNotNull($response, 'Find result is empty'); Test_Assert::assertResponseStatusCode($response, 200, 'Find status code is not 200'); Test_Assert::assertResponsePaginateList($response); @@ -242,7 +242,7 @@ public function testGetTikcetComment() $c->create(); // find comments - $response = $client->get('/api/tenant/current/ticket/' . $t->id . '/comment/' . $c->id); + $response = $client->get('/api/tenant/ticket/' . $t->id . '/comment/' . $c->id); Test_Assert::assertResponseNotNull($response, 'Find result is empty'); Test_Assert::assertResponseStatusCode($response, 200, 'Find status code is not 200'); Test_Assert::assertResponseAsModel($response); @@ -294,7 +294,7 @@ public function testCreateTikcetComment() $t->create(); // find comments - $response = $client->post('/api/tenant/current/ticket/' . $t->id . '/comment/new', array( + $response = $client->post('/api/tenant/ticket/' . $t->id . '/comment/new', array( 'title' => 'test', 'description' => 'test' )); @@ -302,7 +302,7 @@ public function testCreateTikcetComment() $tc = json_decode($response->content, true); // find comments - $response = $client->get('/api/tenant/current/ticket/' . $t->id . '/comment/find'); + $response = $client->get('/api/tenant/ticket/' . $t->id . '/comment/find'); Test_Assert::assertResponseNotNull($response, 'Find result is empty'); Test_Assert::assertResponseStatusCode($response, 200, 'Find status code is not 200'); Test_Assert::assertResponsePaginateList($response); @@ -355,7 +355,7 @@ public function testUpdateTikcetComment() $t->create(); // find comments - $response = $client->post('/api/tenant/current/ticket/' . $t->id . '/comment/new', array( + $response = $client->post('/api/tenant/ticket/' . $t->id . '/comment/new', array( 'title' => 'test', 'description' => 'test' )); @@ -363,14 +363,14 @@ public function testUpdateTikcetComment() $tc = json_decode($response->content, true); // update - $response = $client->post('/api/tenant/current/ticket/' . $t->id . '/comment/' . $tc['id'], array( + $response = $client->post('/api/tenant/ticket/' . $t->id . '/comment/' . $tc['id'], array( 'title' => 'test new title', 'description' => 'test' )); Test_Assert::assertResponseStatusCode($response, 200); // find comments - $response = $client->get('/api/tenant/current/ticket/' . $t->id . '/comment/find'); + $response = $client->get('/api/tenant/ticket/' . $t->id . '/comment/find'); Test_Assert::assertResponseNotNull($response, 'Find result is empty'); Test_Assert::assertResponseStatusCode($response, 200, 'Find status code is not 200'); Test_Assert::assertResponsePaginateList($response); @@ -423,7 +423,7 @@ public function testDeleteTikcetComment() $t->create(); // find comments - $response = $client->post('/api/tenant/current/ticket/' . $t->id . '/comment/new', array( + $response = $client->post('/api/tenant/ticket/' . $t->id . '/comment/new', array( 'title' => 'test', 'description' => 'test' )); @@ -431,11 +431,11 @@ public function testDeleteTikcetComment() $tc = json_decode($response->content, true); // update - $response = $client->delete('/api/tenant/current/ticket/' . $t->id . '/comment/' . $tc['id']); + $response = $client->delete('/api/tenant/ticket/' . $t->id . '/comment/' . $tc['id']); Test_Assert::assertResponseStatusCode($response, 200); // find comments - $response = $client->get('/api/tenant/current/ticket/' . $t->id . '/comment/find'); + $response = $client->get('/api/tenant/ticket/' . $t->id . '/comment/find'); Test_Assert::assertResponseNotNull($response, 'Find result is empty'); Test_Assert::assertResponseStatusCode($response, 200, 'Find status code is not 200'); Test_Assert::assertResponsePaginateList($response); diff --git a/tests/Tenant_REST/TicketTest.php b/tests/Tenant_REST/TicketTest.php index 3c59845..2ee8fc4 100644 --- a/tests/Tenant_REST/TicketTest.php +++ b/tests/Tenant_REST/TicketTest.php @@ -114,7 +114,7 @@ public function testFindTikcets() Test_Assert::assertResponseStatusCode($response, 200, 'Fail to login'); // find teckets - $response = $client->get('/api/tenant/current/ticket/find'); + $response = $client->get('/api/tenant/ticket/find'); Test_Assert::assertResponseNotNull($response, 'Find result is empty'); Test_Assert::assertResponseStatusCode($response, 200, 'Find status code is not 200'); Test_Assert::assertResponsePaginateList($response, 'Find result is not JSON paginated list'); @@ -149,7 +149,7 @@ public function testFindTikcetsNotEmpty() Test_Assert::assertResponseStatusCode($response, 200, 'Fail to login'); // create tecket - $response = $client->post('/api/tenant/current/ticket/new', array( + $response = $client->post('/api/tenant/ticket/new', array( 'type' => 'bug', 'subject' => 'test ticket', 'description' => 'it is not possible to test', @@ -160,14 +160,14 @@ public function testFindTikcetsNotEmpty() $t = json_decode($response->content, true); // find teckets - $response = $client->get('/api/tenant/current/ticket/find'); + $response = $client->get('/api/tenant/ticket/find'); Test_Assert::assertResponseNotNull($response, 'Find result is empty'); Test_Assert::assertResponseStatusCode($response, 200, 'Find status code is not 200'); Test_Assert::assertResponsePaginateList($response, 'Find result is not JSON paginated list'); Test_Assert::assertResponseNonEmptyPaginateList($response, 'No ticket is created'); // delete ticket - $response = $client->delete('/api/tenant/current/ticket/' . $t['id']); + $response = $client->delete('/api/tenant/ticket/' . $t['id']); Test_Assert::assertResponseStatusCode($response, 200, 'Ticket is removed'); } @@ -200,7 +200,7 @@ public function testCreateTikcet() Test_Assert::assertResponseStatusCode($response, 200, 'Fail to login'); // create tecket - $response = $client->post('/api/tenant/current/ticket/new', array( + $response = $client->post('/api/tenant/ticket/new', array( 'type' => 'bug', 'subject' => 'test ticket', 'description' => 'it is not possible to test', @@ -211,7 +211,7 @@ public function testCreateTikcet() $t = json_decode($response->content, true); // delete ticket - $response = $client->delete('/api/tenant/current/ticket/' . $t['id']); + $response = $client->delete('/api/tenant/ticket/' . $t['id']); Test_Assert::assertResponseStatusCode($response, 200, 'Ticket is removed'); } @@ -246,7 +246,7 @@ public function testGetTikcet() Test_Assert::assertResponseStatusCode($response, 200, 'Fail to login'); // create tecket - $response = $client->post('/api/tenant/current/ticket/new', array( + $response = $client->post('/api/tenant/ticket/new', array( 'type' => 'bug', 'subject' => 'test ticket', 'description' => 'it is not possible to test', @@ -257,11 +257,11 @@ public function testGetTikcet() // Get tecket $t = json_decode($response->content, true); - $response = $client->get('/api/tenant/current/ticket/' . $t['id']); + $response = $client->get('/api/tenant/ticket/' . $t['id']); Test_Assert::assertResponseNotAnonymousModel($response, 'Ticket is not find'); // delete ticket - $response = $client->delete('/api/tenant/current/ticket/' . $t['id']); + $response = $client->delete('/api/tenant/ticket/' . $t['id']); Test_Assert::assertResponseStatusCode($response, 200, 'Ticket is removed'); }