С 1.22.00.
Эта страница документации не завершена.
Для работы API тестов нужно заполнить 2 конфигурационные переменные:
$conf{API_TEST_USER_LOGIN}
— логин пользователя для тестов$conf{API_TEST_USER_PASSWORD}
— пароль пользователя для тестовОпционально можете заполнить $conf{API_TEST_URL}
- URL для тестов. По умолчанию это значение localhost.
За пример взят модуль Portal.
Расположение Abills/modules/Portal
Создаём:
Создаём папки для каждого эндпоинта, в ADMIN или(и) USER API например:
И так далее.
За пример взят микромодуль Companies.
Расположение - t/Api
Создаём:
Создаём папки для каждого эндпоинта, в ADMIN или(и) USER API например:
будет дополняться
И в каждом эндпоинте создаём файлы:
Про json-schema почитать тут.
{ "body": { "addressFlat": "4", "archive": 1, "buildId": 8, "content": "<p>Новая Open Source версия биллинга!</p>\n\n\n\n<p>Полный список новинок, исправлений и улучшений биллинга к новому релизу!</p>", "date": "2023-01-27", "districtId": 8, "domainId": 0, "endDate": "", "gid": 0, "importance": 0, "name": "Releases", "onMainPage": 0, "permalink": "releases-abills-095-blackout", "picture": "https://demo.abills.net.ua:9443/images/attach/portal/13863233.jpg", "portalMenuId": 8, "shortDescription": "Встречайте новый релиз 2023", "stName": "", "status": 1, "streetId": 0, "tagName": "", "tags": 0, "title": "Релиз ABillS 0.95 Blackout" }, "method": "POST", "name": "ADMIN_PORTAL_ARTICLES_ADD", "path": "portal/articles/" } |
{ "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "properties": { "affected": { "type": "integer" }, "insertId": { "type": "integer" }, "total": { "type": "integer" } }, "required": ["affected", "insertId", "total"] } |
{ "method": "GET", "name": "ADMIN_PORTAL_ARTICLES_LIST", "path": "portal/articles/" } |
{ "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "properties": { "list": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "integer" }, "archive": { "type": "integer" }, "addressFlat": { "type": "string" }, "buildId": { "type": "number" }, "content": { "type": "string" }, "date": { "type": "string" }, "deeplink": { "type": "integer" }, "districtId": { "type": "string" }, "domainId": { "type": "integer" }, "endDate": { "type": "string" }, "etimestamp": { "type": "integer" }, "gid": { "type": "integer" }, "importance": { "type": "integer" }, "name": { "type": "string" }, "onMainPage": { "type": "integer" }, "permalink": { "type": "string" }, "picture": { "type": "string" }, "portalMenuId": { "type": "integer" }, "shortDescription": { "type": "string" }, "stName": { "type": "string" }, "status": { "type": "integer" }, "streetId": { "type": "integer" }, "tagName": { "type": "string" }, "tags": { "type": "integer" }, "title": { "type": "string" }, "url": { "type": "string" }, "utimestamp": { "type": "integer" } }, "required": [ "id", "archive", "addressFlat", "buildId", "content", "date", "deeplink", "districtId", "domainId", "endDate", "etimestamp", "gid", "importance", "name", "onMainPage", "permalink", "picture", "portalMenuId", "shortDescription", "stName", "status", "streetId", "tagName", "tags", "title", "url", "utimestamp" ] } }, "total": { "type": "number" } }, "required": [ "list", "total" ] } |
{ "body": { "addressFlat": "4", "archive": 1, "buildId": 8, "content": "<p>Новая Open Source версия биллинга!</p>\n\n\n\n<p>Полный список новинок, исправлений и улучшений биллинга к новому релизу!</p>", "date": "2023-01-27", "districtId": 8, "domainId": 0, "endDate": "", "gid": 0, "importance": 0, "name": "Releases", "onMainPage": 0, "permalink": "releases-abills-095-blackout", "picture": "https://demo.abills.net.ua:9443/images/attach/portal/13863233.jpg", "portalMenuId": 8, "shortDescription": "Встречайте новый релиз 2023", "stName": "", "status": 1, "streetId": 0, "tagName": "", "tags": 0, "title": "Релиз ABillS 0.95 Blackout" }, "method": "PUT", "name": "ADMIN_PORTAL_ARTICLE_UPDATE", "path": "portal/articles/:id/" } |
{ "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "properties": { "affected": { "type": "integer" }, "total": { "type": "integer" } }, "required": ["affected", "total"] } |
{ "method": "DELETE", "name": "ADMIN_PORTAL_ARTICLE_DELETE", "path": "portal/articles/:id/" } |
{ "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "properties": { "result": { "type": "string" } }, "required": [ "result" ] } |
Для запуска теста на ваш модуль - запускайте созданный вами Api.t.