From 4971ce61ef4f9d072854f19d35fc4306f7e05eb4 Mon Sep 17 00:00:00 2001 From: Korina Cordero Date: Mon, 22 Jul 2019 09:23:41 +0000 Subject: [PATCH] Remove error_log statement. Add test for list promos and get compatible batteries. Add test data for compatible batteries. #229 --- ...I - API Controller.postman_collection.json | 100 ++++++++++++++---- src/Controller/APIController.php | 6 +- 2 files changed, 82 insertions(+), 24 deletions(-) diff --git a/postman/Resq Mobile API - API Controller.postman_collection.json b/postman/Resq Mobile API - API Controller.postman_collection.json index 475612ce..df7c89e4 100755 --- a/postman/Resq Mobile API - API Controller.postman_collection.json +++ b/postman/Resq Mobile API - API Controller.postman_collection.json @@ -667,7 +667,8 @@ "pm.test(\"List promos\", function () {", " var jsonData = pm.response.json();", " pm.expect(jsonData.error.status).to.eql(\"success\");", - " //pm.expect(jsonData.data.makes).to.have.lengthOf(9);", + " pm.expect(jsonData.data.promos).to.have.lengthOf(9);", + " pm.expect(jsonData.data.promos[0].code).to.eql(\"EMPLOY\");", "});" ], "type": "text/javascript" @@ -711,7 +712,8 @@ "pm.test(\"Get compatible batteries\", function () {", " var jsonData = pm.response.json();", " pm.expect(jsonData.error.status).to.eql(\"success\");", - " ", + " pm.expect(jsonData.data.batteries[0].model_name).to.eql(\"GOLD\");", + " pm.expect(jsonData.data.batteries[0].size_name).to.eql(\"DIN55\");", "});" ], "type": "text/javascript" @@ -741,6 +743,64 @@ } }, "response": [] + }, + { + "name": "[Normal] Request Job Order", + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "formdata", + "formdata": [ + { + "key": "service_type", + "value": "", + "type": "text" + }, + { + "key": "cv_id", + "value": "{{cv_id}}", + "type": "text" + }, + { + "key": "trade_in", + "value": "", + "type": "text" + }, + { + "key": "long", + "value": "", + "type": "text" + }, + { + "key": "lat", + "value": "", + "type": "text" + }, + { + "key": "warranty", + "value": "", + "type": "text" + }, + { + "key": "mode_of_payment", + "value": "", + "type": "text" + } + ] + }, + "url": { + "raw": "{{resq_url}}/api/job_order", + "host": [ + "{{resq_url}}" + ], + "path": [ + "api", + "job_order" + ] + } + }, + "response": [] } ], "event": [ @@ -767,109 +827,109 @@ ], "variable": [ { - "id": "b92a8775-f072-45d6-ba3c-c5c1e697026b", + "id": "ccac43fa-6d1e-49f2-b045-3e80c6d3934f", "key": "resq_url", "value": "resq.local", "type": "string" }, { - "id": "279d5bec-f9d3-431c-8ef7-8bce23f18f0f", + "id": "acc8f492-7460-41b4-911c-d12826ef2017", "key": "phone_model", "value": "iPhone8", "type": "string" }, { - "id": "a747bcd5-9367-4394-97b1-c3caca435f8d", + "id": "43440cfe-0330-4254-a1e0-be0e7f054e1d", "key": "os_type", "value": "IOS", "type": "string" }, { - "id": "b3833b45-b18b-4aaf-8aa5-064caf7a3e6e", + "id": "8b0e4ffb-a6d0-45fd-bae0-2869b3a9a417", "key": "os_version", "value": "11.4", "type": "string" }, { - "id": "a515f94f-c3f9-4bbf-9f17-277fa06ab1b3", + "id": "4a6ebdda-c7b6-4f15-8b85-2afbfd7cab7d", "key": "phone_id", "value": "11376660-F8BF-46ED-B30A-EF3F361EE223", "type": "string" }, { - "id": "fe0a71cc-64eb-4f69-817b-0a98782749b6", + "id": "6ce89a29-4591-41da-b4f0-2945c9ca1f2d", "key": "phone_number", "value": "9221111111", "type": "string" }, { - "id": "c26c982a-7879-4324-9095-229913ee1370", + "id": "d0c15f43-5b04-47f4-b26f-9b05e7c58c64", "key": "first_name", "value": "Stiltzkin", "type": "string" }, { - "id": "c3e57918-f00a-4e6d-9182-f4a86e2f2598", + "id": "3d44e913-b45d-4aaf-9c52-a13e8284a26a", "key": "last_name", "value": "Moogle", "type": "string" }, { - "id": "56657131-867e-430d-a7cf-ec2bbb4ce14a", + "id": "c1a8a58a-e36c-4008-b3cb-be03e2c875fe", "key": "mfg_id", "value": "1435", "type": "string" }, { - "id": "7c6a8217-98e5-4ea1-a3ad-608345e9895c", + "id": "3e6a8c18-a095-4a9d-a230-fda30e649801", "key": "make_id", "value": "22043", "type": "string" }, { - "id": "971f7ee1-d1b3-43da-afce-f32a1344b59f", + "id": "ab6c0e13-73e7-4191-94da-178569ed080c", "key": "name", "value": "Beetle 1.2 TSI MT (Gas)", "type": "string" }, { - "id": "9f1d9e61-1142-45a3-837a-d0c67d6d7731", + "id": "9bd4e6b2-f45e-4e25-a4fa-73c69475d2a1", "key": "plate_num", "value": "MGL1234", "type": "string" }, { - "id": "9d01f14b-8a98-41a2-9c50-bb74988219c5", + "id": "aeb30eac-85c6-42c9-940a-dfa07b17484a", "key": "model_year", "value": "2016", "type": "string" }, { - "id": "f0d9c73d-a485-47da-9f55-5ab8e6ec67b8", + "id": "e58b31b5-f3ca-4d1d-bc4f-272904013a9f", "key": "color", "value": "White", "type": "string" }, { - "id": "2734e723-5e3e-493b-b2ac-baf324ee6c56", + "id": "adaaae50-3591-4fb6-b9d0-d92b4b40dda2", "key": "condition", "value": "Brand New", "type": "string" }, { - "id": "43d61623-17d2-4502-b225-74b40af420c0", + "id": "23d8e583-0b00-4644-98f4-c9ce3307d312", "key": "fuel_type", "value": "Gas", "type": "string" }, { - "id": "85fb5ff9-e4b8-4400-9093-54f4258a6780", + "id": "0a9ab79f-75f3-46c2-829d-bb437f656cd5", "key": "wty_code", "value": "MKUP0123456", "type": "string" }, { - "id": "34611113-838e-4e43-9964-d69cb3d900aa", + "id": "167fbcaa-0dd1-4b34-aff7-df5c009d8b06", "key": "wty_expire", "value": "20201125", "type": "string" diff --git a/src/Controller/APIController.php b/src/Controller/APIController.php index bfa5d5eb..73b40583 100644 --- a/src/Controller/APIController.php +++ b/src/Controller/APIController.php @@ -720,8 +720,6 @@ class APIController extends Controller // get promos $promos = $em->getRepository(Promo::class)->findBy([], ['name' => 'asc']); - error_log("mogol " . count($promos)); - $promo_list = []; foreach($promos as $promo) { @@ -771,9 +769,9 @@ class APIController extends Controller 'mfg_id' => $batt->getManufacturer()->getID(), 'mfg_name' => $batt->getManufacturer()->getName(), 'model_id' => $batt->getModel()->getID(), - 'model_name' => $batt->getModel()->getName(), + 'model_name' => trim($batt->getModel()->getName()), 'size_id' => $batt->getSize()->getID(), - 'size_name' => $batt->getSize()->getName(), + 'size_name' => trim($batt->getSize()->getName()), 'price' => $batt->getSellingPrice(), 'wty_private' => $batt->getWarrantyPrivate(), 'wty_commercial' => $batt->getWarrantyCommercial(),