cst/leantesting
Composer 安装命令:
composer require --dev cst/leantesting
包简介
Lean Testing PHP SDK
关键字:
README 文档
README
PHP client for Lean Testing API
You can sign up for a Lean Testing account at https://leantesting.com.
Requirements
- PHP 5.4 or greater
Installation
The library is installed via Composer. To install, simply add it
to your composer.json file:
{
"require": {
"cst/leantesting": "2.*"
}
}
And run composer to update your dependencies:
$ curl -s http://getcomposer.org/installer | php
$ php composer.phar update
Basic Usage
- Instantiate the client
$client = new LeanTesting\API\Client\Client(); $client->attachToken('<your token>'); // Listing projects $projects = $client->projects->all(); // Fetching project bugs $bugs = $client->projects->find(123)->bugs->all();
Methods
- Get Current Token
$client->getCurrentToken()
- Attach New Token
$client->attachToken('<token>');
- Generate Authorization URL
$generated_URL = $client->auth->generateAuthLink( 'DHxaSvtpl91Xos4vb7d0GKkXRu0GJxd5Rdha2HHx', // client id 'https://www.example.com/appurl/', 'write', // scope 'a3ahdh2iqhdasdasfdjahf26' // random string ); print_r( $generated_URL );
- Exchange authorization code for an access token
$token = $client->auth->exchangeAuthCode( 'DHxaSvtpl91Xos4vb7d0GKkXRu0GJxd5Rdha2asdasdx', // client id 'DpOZxNbeL1arVbjUINoA9pOhgS8FNQsOkpE4CtXU', // client secret 'authorization_code', 'JKHanMA897A7KA9ajqmxly', // auth code 'https://www.example.com/appurl/' ); print_r( $token );
- Get User Information
$client->user->getInformation()
- Get User Organizations
$client->user->organizations->all()->toArray()
- Retrieve An Existing User Organization
$client->user->organizations->find(31)->data
- List All Projects
$client->projects->all()->toArray()
- Create A New Project
$new_project = $client->projects->create([ 'name' => 'Project135', 'organization_id' => 5779 ]); print_r( $new_project->data );
- Retrieve An Existing Project
$client->projects->find(3515)->data
- List Project Sections
$client->projects->find(3515)->sections->all()->toArray()
- Adding A Project Section
$new_section = $client->projects->find(3515)->sections->create([ 'name' => 'SectionName' ]); print_r( $new_section->data );
- List Project Versions
$client->projects->find(3515)->versions->all()->toArray()
- Adding A Project Version
$new_version = $client->projects->find(3515)->versions->create([ 'number' => 'v0.3.1104' ]); print_r( $new_version->data );
- List Project Test Cases
$client->projects->find(3515)->testCases->all()->toArray();
- List Project Test Runs
$client->projects->find(3515)->testRuns->all()->toArray();
- Retrieve Results For Test Run
$client->projects->find(3515)->testRuns->find(123)->data;
- List Project Users
$client->projects->find(3515)->users->all()->toArray();
- Remove A Project User
$client->projects->find(3515)->users->delete(123);
- List Bug Type Scheme
$client->projects->find(3515)->bugTypeScheme->all()->toArray()
- List Bug Status Scheme
$client->projects->find(3515)->bugStatusScheme->all()->toArray()
- List Bug Severity Scheme
$client->projects->find(3515)->bugSeverityScheme->all()->toArray()
- List Bug Reproducibility Scheme
$client->projects->find(3515)->bugReproducibilityScheme->all()->toArray()
- List All Bugs In A Project
$client->projects->find(3515)->bugs->all()->toArray()
- Create A New Bug
$new_bug = $client->projects->find(3515)->bugs->create([ 'title' => 'Something bad happened...', 'status_id' => 1, 'severity_id' => 2, 'project_version_id' => 123 ]); print_r( $new_bug->data );
- Retrieve Existing Bug
$client->bugs->find(123)->data
- Update A Bug
$updated_bug = $client->bugs->update(123, [ 'title' => 'Updated title', 'status_id' => 1, 'severity_id' => 2, 'project_version_id' => 123 ]); print_r( $updated_bug->data );
- Delete A Bug
$client->bugs->delete(123)
- List Bug Comments
$client->bugs->find(123)->comments->all()->toArray()
- List Bug Attachments
$client->bugs->find(123)->attachments->all()->toArray()
- Upload An Attachment
$file_path = '/place/Downloads/Images/1370240743_2294218.jpg'; $new_attachment = $client->bugs->find(123)->attachments->upload($file_path); print_r( $new_attachment->data )
- Retrieve An Existing Attachment
$client->attachments->find(21515)->data
- Delete An Attachment
$client->attachments->delete(75198)
- List Platform Types
$client->platform->types->all()->toArray()
- Retrieve Platform Type
$client->platform->types->find(1)->data
- List Platform Devices
$client->platform->types->find(1)->devices->all()->toArray()
- Retrieve Existing Device
$client->platform->devices->find(11)->data
- List OS
$client->platform->os->all()->toArray()
- Retrieve Existing OS
$client->platform->os->find(1)->data
- List OS Versions
$client->platform->os->find(1)->versions->all()->toArray()
- List Browsers
$client->platform->browsers->all()->toArray()
- Retrieve Existing Browser
$client->platform->browsers->find(1)->data
- List Browser Versions
$client->platform->browsers->find(1)->versions->all()->toArray()
- Using Filters
$client->projects->find(3515)->bugs->all(['limit' => 2, 'page' => 5]).toArray();
- Entity List Functions
$browsers = $client->platform->browsers->all() echo $browsers->total() echo $browsers->totalPages() echo $browsers->count() echo $browsers->toArray()
- Entity List Iterator
When used in foreach() loops, entity lists will automatically rewind, regardless of
pagefilter. After ending the loop, the entity list will NOT revert to first page or the initial instancingpagefilter setting in order not to cause useless API request calls.
$comments = $client->bugs->find(123)->comments->all(['limit' => 1]); foreach ($comments as $page) { print_r( $page ); }
- Entity List Manual Iteration
$comments = $client->bugs->find(123)->comments->all(['limit' => 1]); echo $comments->toArray(); // Will return false if unable to move forwards $comments->next(); echo $comments->toArray(); // Will return false if already on last page $comments->last(); echo $comments->toArray(); // Will return false if unable to move backwards $comments->previous(); echo $comments->toArray(); // Will return false if already on first page $comments->first(); echo $comments->toArray();
Security
Need to report a security vulnerability? Send us an email to support@crowdsourcedtesting.com or go directly to our security bug bounty site https://hackerone.com/leantesting.
Development
Install dependencies:
composer install
Tests
Install dependencies as mentioned above (which will resolve PHPUnit), then you can run the test suite:
./vendor/bin/phpunit
Contributing
Please see CONTRIBUTING for details.
cst/leantesting 适用场景与选型建议
cst/leantesting 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 251 次下载、GitHub Stars 达 2, 最近一次更新时间为 2015 年 11 月 27 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「api」 「testing」 「bug tracker」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 cst/leantesting 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 cst/leantesting 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 cst/leantesting 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Fix whereHas for morphTo relations.
Testing Suite For Lumen like Laravel does.
A PSR-7 compatible library for making CRUD API endpoints
The PHP SDK for Checkmango
This bundle allows to track bugs in your application and automatically create issues with all the information required on your repository
A php class for Laravel to send bug reports with data
统计信息
- 总下载量: 251
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 11
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-11-27