diff --git a/app/Coding/Iteration.php b/app/Coding/Iteration.php index d105293..8ec9031 100644 --- a/app/Coding/Iteration.php +++ b/app/Coding/Iteration.php @@ -3,30 +3,9 @@ namespace App\Coding; use Carbon\Carbon; -use Exception; class Iteration extends Base { - public function create($token, $projectName, $data) - { - $response = $this->client->request('POST', 'https://e.coding.net/open-api', [ - 'headers' => [ - 'Accept' => 'application/json', - 'Authorization' => "token ${token}", - 'Content-Type' => 'application/json' - ], - 'json' => array_merge([ - 'Action' => 'CreateIteration', - 'ProjectName' => $projectName, - ], $data), - ]); - $result = json_decode($response->getBody(), true); - if (isset($result['Response']['Error']['Message'])) { - throw new Exception($result['Response']['Error']['Message']); - } - return $result['Response']['Iteration']; - } - public static function generateName(Carbon $startAt, Carbon $endAt): string { $endFormat = $startAt->year == $endAt->year ? 'm/d' : 'Y/m/d'; diff --git a/app/Commands/IterationCreateCommand.php b/app/Commands/IterationCreateCommand.php index 80d79ed..bc1745a 100644 --- a/app/Commands/IterationCreateCommand.php +++ b/app/Commands/IterationCreateCommand.php @@ -2,8 +2,9 @@ namespace App\Commands; -use App\Coding\Iteration; +use App\Coding\Iteration as LocalIteration; use Carbon\Carbon; +use Coding\Iteration; use LaravelZero\Framework\Commands\Command; class IterationCreateCommand extends Command @@ -40,8 +41,11 @@ class IterationCreateCommand extends Command public function handle(Iteration $iteration): int { $this->setCodingApi(); + $iteration->setToken($this->codingToken); - $data = []; + $data = [ + 'ProjectName' => $this->codingProjectUri, + ]; $startAt = Carbon::parse($this->option('start_at') ?? $this->ask('开始时间:', Carbon::today()->toDateString())); $data['StartAt'] = $startAt->toDateString(); $endAt = Carbon::parse($this->option('end_at') ?? $this->ask( @@ -49,11 +53,11 @@ public function handle(Iteration $iteration): int Carbon::today()->addDays(14)->toDateString() )); $data['EndAt'] = $endAt->toDateString(); - $data['Name'] = $this->option('name') ?? $this->ask('标题:', Iteration::generateName($startAt, $endAt)); + $data['Name'] = $this->option('name') ?? $this->ask('标题:', LocalIteration::generateName($startAt, $endAt)); $data['Goal'] = $this->option('goal'); $data['Assignee'] = $this->option('assignee'); - $result = $iteration->create($this->codingToken, $this->codingProjectUri, $data); + $result = $iteration->create($data); $this->info('创建成功'); $this->info("https://{$this->codingTeamDomain}.coding.net/p/{$this->codingProjectUri}" . diff --git a/composer.json b/composer.json index a306282..e800b44 100644 --- a/composer.json +++ b/composer.json @@ -22,6 +22,7 @@ "ext-json": "*", "ext-libxml": "*", "ext-zip": "*", + "coding/sdk": "^0.1.2", "illuminate/log": "^8.0", "laravel-fans/confluence": "^0.1.1", "laravel-zero/framework": "^8.8", diff --git a/composer.lock b/composer.lock index 0a7476d..3528ba6 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "0134f2de9ac0b0a115a392c6dfb421dc", + "content-hash": "7bd97de09ac0e5981d59996e4f1ddb21", "packages": [ { "name": "box/spout", @@ -140,36 +140,76 @@ ], "time": "2021-08-15T20:50:18+00:00" }, + { + "name": "coding/sdk", + "version": "0.1.2", + "source": { + "type": "git", + "url": "https://github.com/Coding/coding-sdk-php.git", + "reference": "b3885378414a1906b179fe656ae4f0831bb23068" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Coding/coding-sdk-php/zipball/b3885378414a1906b179fe656ae4f0831bb23068", + "reference": "b3885378414a1906b179fe656ae4f0831bb23068", + "shasum": "" + }, + "require": { + "ext-json": "*", + "guzzlehttp/guzzle": "^7.4", + "illuminate/validation": "^8.67", + "php": ">=7.4" + }, + "require-dev": { + "fakerphp/faker": "^1.16", + "mockery/mockery": "^1.4", + "phpmd/phpmd": "^2.10", + "phpunit/phpunit": "^9.5", + "squizlabs/php_codesniffer": "^3.6" + }, + "type": "library", + "autoload": { + "psr-4": { + "Coding\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "description": "CODING.net SDK for PHP", + "support": { + "issues": "https://github.com/Coding/coding-sdk-php/issues", + "source": "https://github.com/Coding/coding-sdk-php/tree/0.1.2" + }, + "time": "2021-10-24T05:56:17+00:00" + }, { "name": "doctrine/inflector", - "version": "2.0.3", + "version": "2.0.4", "source": { "type": "git", "url": "https://github.com/doctrine/inflector.git", - "reference": "9cf661f4eb38f7c881cac67c75ea9b00bf97b210" + "reference": "8b7ff3e4b7de6b2c84da85637b59fd2880ecaa89" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/inflector/zipball/9cf661f4eb38f7c881cac67c75ea9b00bf97b210", - "reference": "9cf661f4eb38f7c881cac67c75ea9b00bf97b210", + "url": "https://api.github.com/repos/doctrine/inflector/zipball/8b7ff3e4b7de6b2c84da85637b59fd2880ecaa89", + "reference": "8b7ff3e4b7de6b2c84da85637b59fd2880ecaa89", "shasum": "" }, "require": { "php": "^7.2 || ^8.0" }, "require-dev": { - "doctrine/coding-standard": "^7.0", - "phpstan/phpstan": "^0.11", - "phpstan/phpstan-phpunit": "^0.11", - "phpstan/phpstan-strict-rules": "^0.11", - "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0" + "doctrine/coding-standard": "^8.2", + "phpstan/phpstan": "^0.12", + "phpstan/phpstan-phpunit": "^0.12", + "phpstan/phpstan-strict-rules": "^0.12", + "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0", + "vimeo/psalm": "^4.10" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, "autoload": { "psr-4": { "Doctrine\\Inflector\\": "lib/Doctrine/Inflector" @@ -217,7 +257,7 @@ ], "support": { "issues": "https://github.com/doctrine/inflector/issues", - "source": "https://github.com/doctrine/inflector/tree/2.0.x" + "source": "https://github.com/doctrine/inflector/tree/2.0.4" }, "funding": [ { @@ -233,7 +273,87 @@ "type": "tidelift" } ], - "time": "2020-05-29T15:13:26+00:00" + "time": "2021-10-22T20:16:43+00:00" + }, + { + "name": "doctrine/lexer", + "version": "1.2.1", + "source": { + "type": "git", + "url": "https://github.com/doctrine/lexer.git", + "reference": "e864bbf5904cb8f5bb334f99209b48018522f042" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/lexer/zipball/e864bbf5904cb8f5bb334f99209b48018522f042", + "reference": "e864bbf5904cb8f5bb334f99209b48018522f042", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "require-dev": { + "doctrine/coding-standard": "^6.0", + "phpstan/phpstan": "^0.11.8", + "phpunit/phpunit": "^8.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Common\\Lexer\\": "lib/Doctrine/Common/Lexer" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.", + "homepage": "https://www.doctrine-project.org/projects/lexer.html", + "keywords": [ + "annotations", + "docblock", + "lexer", + "parser", + "php" + ], + "support": { + "issues": "https://github.com/doctrine/lexer/issues", + "source": "https://github.com/doctrine/lexer/tree/1.2.1" + }, + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Flexer", + "type": "tidelift" + } + ], + "time": "2020-05-25T17:44:05+00:00" }, { "name": "dragonmantank/cron-expression", @@ -296,6 +416,74 @@ ], "time": "2020-11-24T19:55:57+00:00" }, + { + "name": "egulias/email-validator", + "version": "2.1.25", + "source": { + "type": "git", + "url": "https://github.com/egulias/EmailValidator.git", + "reference": "0dbf5d78455d4d6a41d186da50adc1122ec066f4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/0dbf5d78455d4d6a41d186da50adc1122ec066f4", + "reference": "0dbf5d78455d4d6a41d186da50adc1122ec066f4", + "shasum": "" + }, + "require": { + "doctrine/lexer": "^1.0.1", + "php": ">=5.5", + "symfony/polyfill-intl-idn": "^1.10" + }, + "require-dev": { + "dominicsayers/isemail": "^3.0.7", + "phpunit/phpunit": "^4.8.36|^7.5.15", + "satooshi/php-coveralls": "^1.0.1" + }, + "suggest": { + "ext-intl": "PHP Internationalization Libraries are required to use the SpoofChecking validation" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Egulias\\EmailValidator\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Eduardo Gulias Davis" + } + ], + "description": "A library for validating emails against several RFCs", + "homepage": "https://github.com/egulias/EmailValidator", + "keywords": [ + "email", + "emailvalidation", + "emailvalidator", + "validation", + "validator" + ], + "support": { + "issues": "https://github.com/egulias/EmailValidator/issues", + "source": "https://github.com/egulias/EmailValidator/tree/2.1.25" + }, + "funding": [ + { + "url": "https://github.com/egulias", + "type": "github" + } + ], + "time": "2020-12-29T14:50:06+00:00" + }, { "name": "facade/ignition-contracts", "version": "1.0.2", @@ -773,16 +961,16 @@ }, { "name": "guzzlehttp/promises", - "version": "1.5.0", + "version": "1.5.1", "source": { "type": "git", "url": "https://github.com/guzzle/promises.git", - "reference": "136a635e2b4a49b9d79e9c8fee267ffb257fdba0" + "reference": "fe752aedc9fd8fcca3fe7ad05d419d32998a06da" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/promises/zipball/136a635e2b4a49b9d79e9c8fee267ffb257fdba0", - "reference": "136a635e2b4a49b9d79e9c8fee267ffb257fdba0", + "url": "https://api.github.com/repos/guzzle/promises/zipball/fe752aedc9fd8fcca3fe7ad05d419d32998a06da", + "reference": "fe752aedc9fd8fcca3fe7ad05d419d32998a06da", "shasum": "" }, "require": { @@ -837,7 +1025,7 @@ ], "support": { "issues": "https://github.com/guzzle/promises/issues", - "source": "https://github.com/guzzle/promises/tree/1.5.0" + "source": "https://github.com/guzzle/promises/tree/1.5.1" }, "funding": [ { @@ -853,7 +1041,7 @@ "type": "tidelift" } ], - "time": "2021-10-07T13:05:22+00:00" + "time": "2021-10-22T20:56:57+00:00" }, { "name": "guzzlehttp/psr7", @@ -1056,16 +1244,16 @@ }, { "name": "illuminate/bus", - "version": "v8.65.0", + "version": "v8.67.0", "source": { "type": "git", "url": "https://github.com/illuminate/bus.git", - "reference": "a222094903c473b6b0ade0b0b0e20b83ae1472b6" + "reference": "be400399687b97d5558a224e970060fd5d5f2735" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/bus/zipball/a222094903c473b6b0ade0b0b0e20b83ae1472b6", - "reference": "a222094903c473b6b0ade0b0b0e20b83ae1472b6", + "url": "https://api.github.com/repos/illuminate/bus/zipball/be400399687b97d5558a224e970060fd5d5f2735", + "reference": "be400399687b97d5558a224e970060fd5d5f2735", "shasum": "" }, "require": { @@ -1105,11 +1293,11 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2021-09-15T14:32:50+00:00" + "time": "2021-10-21T19:19:36+00:00" }, { "name": "illuminate/cache", - "version": "v8.65.0", + "version": "v8.67.0", "source": { "type": "git", "url": "https://github.com/illuminate/cache.git", @@ -1169,16 +1357,16 @@ }, { "name": "illuminate/collections", - "version": "v8.65.0", + "version": "v8.67.0", "source": { "type": "git", "url": "https://github.com/illuminate/collections.git", - "reference": "dca614ef58d05d01c5610ae9c91536f4afe6f695" + "reference": "2142c8cf75f1cf4416a5f414a6ed377de4b73ad9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/collections/zipball/dca614ef58d05d01c5610ae9c91536f4afe6f695", - "reference": "dca614ef58d05d01c5610ae9c91536f4afe6f695", + "url": "https://api.github.com/repos/illuminate/collections/zipball/2142c8cf75f1cf4416a5f414a6ed377de4b73ad9", + "reference": "2142c8cf75f1cf4416a5f414a6ed377de4b73ad9", "shasum": "" }, "require": { @@ -1219,11 +1407,11 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2021-10-14T15:27:26+00:00" + "time": "2021-10-20T22:21:30+00:00" }, { "name": "illuminate/config", - "version": "v8.65.0", + "version": "v8.67.0", "source": { "type": "git", "url": "https://github.com/illuminate/config.git", @@ -1271,16 +1459,16 @@ }, { "name": "illuminate/console", - "version": "v8.65.0", + "version": "v8.67.0", "source": { "type": "git", "url": "https://github.com/illuminate/console.git", - "reference": "9d450507e8106002ec948c7108075cc0a72e5216" + "reference": "9c66af18f7a491d45dc7527837f22a175776870a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/console/zipball/9d450507e8106002ec948c7108075cc0a72e5216", - "reference": "9d450507e8106002ec948c7108075cc0a72e5216", + "url": "https://api.github.com/repos/illuminate/console/zipball/9c66af18f7a491d45dc7527837f22a175776870a", + "reference": "9c66af18f7a491d45dc7527837f22a175776870a", "shasum": "" }, "require": { @@ -1327,11 +1515,11 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2021-10-14T18:05:05+00:00" + "time": "2021-10-21T19:19:36+00:00" }, { "name": "illuminate/container", - "version": "v8.65.0", + "version": "v8.67.0", "source": { "type": "git", "url": "https://github.com/illuminate/container.git", @@ -1382,7 +1570,7 @@ }, { "name": "illuminate/contracts", - "version": "v8.65.0", + "version": "v8.67.0", "source": { "type": "git", "url": "https://github.com/illuminate/contracts.git", @@ -1430,7 +1618,7 @@ }, { "name": "illuminate/events", - "version": "v8.65.0", + "version": "v8.67.0", "source": { "type": "git", "url": "https://github.com/illuminate/events.git", @@ -1485,16 +1673,16 @@ }, { "name": "illuminate/filesystem", - "version": "v8.65.0", + "version": "v8.67.0", "source": { "type": "git", "url": "https://github.com/illuminate/filesystem.git", - "reference": "f33219e5550f8f280169e933b91a95250920de06" + "reference": "a7bc30dac4e27dbeb37b026f3dbaee13bd578861" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/filesystem/zipball/f33219e5550f8f280169e933b91a95250920de06", - "reference": "f33219e5550f8f280169e933b91a95250920de06", + "url": "https://api.github.com/repos/illuminate/filesystem/zipball/a7bc30dac4e27dbeb37b026f3dbaee13bd578861", + "reference": "a7bc30dac4e27dbeb37b026f3dbaee13bd578861", "shasum": "" }, "require": { @@ -1543,20 +1731,20 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2021-07-20T13:46:01+00:00" + "time": "2021-10-22T13:20:42+00:00" }, { "name": "illuminate/log", - "version": "v8.65.0", + "version": "v8.67.0", "source": { "type": "git", "url": "https://github.com/illuminate/log.git", - "reference": "56d0383bcd8f7c3ba2ff9868e47459998953f4d7" + "reference": "48f459af3ffc2b5dc030986742812cfb0b9babcc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/log/zipball/56d0383bcd8f7c3ba2ff9868e47459998953f4d7", - "reference": "56d0383bcd8f7c3ba2ff9868e47459998953f4d7", + "url": "https://api.github.com/repos/illuminate/log/zipball/48f459af3ffc2b5dc030986742812cfb0b9babcc", + "reference": "48f459af3ffc2b5dc030986742812cfb0b9babcc", "shasum": "" }, "require": { @@ -1592,11 +1780,11 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2021-10-05T16:21:49+00:00" + "time": "2021-10-20T14:18:17+00:00" }, { "name": "illuminate/macroable", - "version": "v8.65.0", + "version": "v8.67.0", "source": { "type": "git", "url": "https://github.com/illuminate/macroable.git", @@ -1642,7 +1830,7 @@ }, { "name": "illuminate/pipeline", - "version": "v8.65.0", + "version": "v8.67.0", "source": { "type": "git", "url": "https://github.com/illuminate/pipeline.git", @@ -1690,16 +1878,16 @@ }, { "name": "illuminate/support", - "version": "v8.65.0", + "version": "v8.67.0", "source": { "type": "git", "url": "https://github.com/illuminate/support.git", - "reference": "066058e2f017d818cf6fe37ae7b103ed1312f76a" + "reference": "85b6513696d407280b54014865dca4e3fcdccce3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/support/zipball/066058e2f017d818cf6fe37ae7b103ed1312f76a", - "reference": "066058e2f017d818cf6fe37ae7b103ed1312f76a", + "url": "https://api.github.com/repos/illuminate/support/zipball/85b6513696d407280b54014865dca4e3fcdccce3", + "reference": "85b6513696d407280b54014865dca4e3fcdccce3", "shasum": "" }, "require": { @@ -1709,7 +1897,7 @@ "illuminate/collections": "^8.0", "illuminate/contracts": "^8.0", "illuminate/macroable": "^8.0", - "nesbot/carbon": "^2.31", + "nesbot/carbon": "^2.53.1", "php": "^7.3|^8.0", "voku/portable-ascii": "^1.4.8" }, @@ -1754,20 +1942,20 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2021-10-18T13:43:07+00:00" + "time": "2021-10-22T13:20:42+00:00" }, { "name": "illuminate/testing", - "version": "v8.65.0", + "version": "v8.67.0", "source": { "type": "git", "url": "https://github.com/illuminate/testing.git", - "reference": "be26a610573fafa9ca893e465aaea3c6e4a35779" + "reference": "e55e0e2d0655fc606d01744140528848c9b80887" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/testing/zipball/be26a610573fafa9ca893e465aaea3c6e4a35779", - "reference": "be26a610573fafa9ca893e465aaea3c6e4a35779", + "url": "https://api.github.com/repos/illuminate/testing/zipball/e55e0e2d0655fc606d01744140528848c9b80887", + "reference": "e55e0e2d0655fc606d01744140528848c9b80887", "shasum": "" }, "require": { @@ -1812,7 +2000,118 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2021-10-18T13:37:32+00:00" + "time": "2021-10-20T13:28:43+00:00" + }, + { + "name": "illuminate/translation", + "version": "v8.67.0", + "source": { + "type": "git", + "url": "https://github.com/illuminate/translation.git", + "reference": "019c83d17b6311be5e52ab99487804d210110d9d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/illuminate/translation/zipball/019c83d17b6311be5e52ab99487804d210110d9d", + "reference": "019c83d17b6311be5e52ab99487804d210110d9d", + "shasum": "" + }, + "require": { + "ext-json": "*", + "illuminate/collections": "^8.0", + "illuminate/contracts": "^8.0", + "illuminate/filesystem": "^8.0", + "illuminate/macroable": "^8.0", + "illuminate/support": "^8.0", + "php": "^7.3|^8.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "8.x-dev" + } + }, + "autoload": { + "psr-4": { + "Illuminate\\Translation\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "description": "The Illuminate Translation package.", + "homepage": "https://laravel.com", + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "time": "2021-10-21T16:07:23+00:00" + }, + { + "name": "illuminate/validation", + "version": "v8.67.0", + "source": { + "type": "git", + "url": "https://github.com/illuminate/validation.git", + "reference": "221e63001f0c698b5df2300224aae6409267d2b9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/illuminate/validation/zipball/221e63001f0c698b5df2300224aae6409267d2b9", + "reference": "221e63001f0c698b5df2300224aae6409267d2b9", + "shasum": "" + }, + "require": { + "egulias/email-validator": "^2.1.10", + "ext-json": "*", + "illuminate/collections": "^8.0", + "illuminate/container": "^8.0", + "illuminate/contracts": "^8.0", + "illuminate/macroable": "^8.0", + "illuminate/support": "^8.0", + "illuminate/translation": "^8.0", + "php": "^7.3|^8.0", + "symfony/http-foundation": "^5.1.4", + "symfony/mime": "^5.1.4" + }, + "suggest": { + "illuminate/database": "Required to use the database presence verifier (^8.0)." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "8.x-dev" + } + }, + "autoload": { + "psr-4": { + "Illuminate\\Validation\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "description": "The Illuminate Validation package.", + "homepage": "https://laravel.com", + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "time": "2021-10-13T13:37:38+00:00" }, { "name": "jolicode/jolinotif", @@ -3892,6 +4191,162 @@ ], "time": "2021-08-04T21:20:46+00:00" }, + { + "name": "symfony/http-foundation", + "version": "v5.3.7", + "source": { + "type": "git", + "url": "https://github.com/symfony/http-foundation.git", + "reference": "e36c8e5502b4f3f0190c675f1c1f1248a64f04e5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/e36c8e5502b4f3f0190c675f1c1f1248a64f04e5", + "reference": "e36c8e5502b4f3f0190c675f1c1f1248a64f04e5", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1", + "symfony/polyfill-mbstring": "~1.1", + "symfony/polyfill-php80": "^1.16" + }, + "require-dev": { + "predis/predis": "~1.0", + "symfony/cache": "^4.4|^5.0", + "symfony/expression-language": "^4.4|^5.0", + "symfony/mime": "^4.4|^5.0" + }, + "suggest": { + "symfony/mime": "To use the file extension guesser" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\HttpFoundation\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Defines an object-oriented layer for the HTTP specification", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/http-foundation/tree/v5.3.7" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-08-27T11:20:35+00:00" + }, + { + "name": "symfony/mime", + "version": "v5.3.8", + "source": { + "type": "git", + "url": "https://github.com/symfony/mime.git", + "reference": "a756033d0a7e53db389618653ae991eba5a19a11" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/mime/zipball/a756033d0a7e53db389618653ae991eba5a19a11", + "reference": "a756033d0a7e53db389618653ae991eba5a19a11", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1", + "symfony/polyfill-intl-idn": "^1.10", + "symfony/polyfill-mbstring": "^1.0", + "symfony/polyfill-php80": "^1.16" + }, + "conflict": { + "egulias/email-validator": "~3.0.0", + "phpdocumentor/reflection-docblock": "<3.2.2", + "phpdocumentor/type-resolver": "<1.4.0", + "symfony/mailer": "<4.4" + }, + "require-dev": { + "egulias/email-validator": "^2.1.10|^3.1", + "phpdocumentor/reflection-docblock": "^3.0|^4.0|^5.0", + "symfony/dependency-injection": "^4.4|^5.0", + "symfony/property-access": "^4.4|^5.1", + "symfony/property-info": "^4.4|^5.1", + "symfony/serializer": "^5.2" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Mime\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Allows manipulating MIME messages", + "homepage": "https://symfony.com", + "keywords": [ + "mime", + "mime-type" + ], + "support": { + "source": "https://github.com/symfony/mime/tree/v5.3.8" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-09-10T12:30:38+00:00" + }, { "name": "symfony/polyfill-ctype", "version": "v1.23.0", @@ -4052,6 +4507,93 @@ ], "time": "2021-05-27T12:26:48+00:00" }, + { + "name": "symfony/polyfill-intl-idn", + "version": "v1.23.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-intl-idn.git", + "reference": "65bd267525e82759e7d8c4e8ceea44f398838e65" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/65bd267525e82759e7d8c4e8ceea44f398838e65", + "reference": "65bd267525e82759e7d8c4e8ceea44f398838e65", + "shasum": "" + }, + "require": { + "php": ">=7.1", + "symfony/polyfill-intl-normalizer": "^1.10", + "symfony/polyfill-php72": "^1.10" + }, + "suggest": { + "ext-intl": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.23-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Intl\\Idn\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Laurent Bassin", + "email": "laurent@bassin.info" + }, + { + "name": "Trevor Rowbotham", + "email": "trevor.rowbotham@pm.me" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "idn", + "intl", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.23.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-05-27T09:27:20+00:00" + }, { "name": "symfony/polyfill-intl-normalizer", "version": "v1.23.0", @@ -4216,6 +4758,82 @@ ], "time": "2021-05-27T12:26:48+00:00" }, + { + "name": "symfony/polyfill-php72", + "version": "v1.23.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php72.git", + "reference": "9a142215a36a3888e30d0a9eeea9766764e96976" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/9a142215a36a3888e30d0a9eeea9766764e96976", + "reference": "9a142215a36a3888e30d0a9eeea9766764e96976", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.23-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php72\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php72/tree/v1.23.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-05-27T09:17:38+00:00" + }, { "name": "symfony/polyfill-php73", "version": "v1.23.0", @@ -7341,7 +7959,6 @@ "type": "github" } ], - "abandoned": true, "time": "2020-09-28T06:45:17+00:00" }, { diff --git a/tests/Feature/IterationCreateCommandTest.php b/tests/Feature/IterationCreateCommandTest.php index b7746e6..8a8a2b8 100755 --- a/tests/Feature/IterationCreateCommandTest.php +++ b/tests/Feature/IterationCreateCommandTest.php @@ -2,8 +2,8 @@ namespace Tests\Feature; -use App\Coding\Iteration; use Carbon\Carbon; +use Coding\Iteration; use Tests\TestCase; class IterationCreateCommandTest extends TestCase diff --git a/tests/Unit/CodingIterationTest.php b/tests/Unit/CodingIterationTest.php index b0cdb5b..f83f664 100644 --- a/tests/Unit/CodingIterationTest.php +++ b/tests/Unit/CodingIterationTest.php @@ -2,48 +2,12 @@ namespace Tests\Unit; -use App\Coding\Issue; use App\Coding\Iteration; use Carbon\Carbon; -use GuzzleHttp\Client; -use GuzzleHttp\Psr7\Response; use Tests\TestCase; class CodingIterationTest extends TestCase { - public function testCreateSuccess() - { - $responseBody = file_get_contents($this->dataDir . 'coding/CreateIterationResponse.json'); - $codingToken = $this->faker->md5; - $codingProjectUri = $this->faker->slug; - $data = [ - 'Name' => $this->faker->title, - ]; - - $clientMock = $this->getMockBuilder(Client::class)->getMock(); - $clientMock->expects($this->once()) - ->method('request') - ->with( - 'POST', - 'https://e.coding.net/open-api', - [ - 'headers' => [ - 'Accept' => 'application/json', - 'Authorization' => "token ${codingToken}", - 'Content-Type' => 'application/json' - ], - 'json' => array_merge([ - 'Action' => 'CreateIteration', - 'ProjectName' => $codingProjectUri, - ], $data) - ] - ) - ->willReturn(new Response(200, [], $responseBody)); - $coding = new Iteration($clientMock); - $result = $coding->create($codingToken, $codingProjectUri, $data); - $this->assertEquals(json_decode($responseBody, true)['Response']['Iteration'], $result); - } - public function testGenerateName() { $startAt = Carbon::parse('2021-10-20');