├── .editorconfig ├── .gitattributes ├── .github ├── FUNDING.yml ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md └── workflows │ ├── php-cs-fixer.yml │ └── tests.yml ├── .gitignore ├── .php_cs ├── .php_cs.cache ├── CODE_OF_CONDUCT.md ├── composer.json ├── laravel-envoyer-sdk.png ├── phpunit.xml.dist ├── src ├── Envoyer.php └── Resources │ ├── Action.php │ ├── Collaborator.php │ ├── Deployment.php │ ├── Environment.php │ ├── EnvoyerResource.php │ ├── Hook.php │ ├── Notification.php │ ├── Project.php │ └── Server.php └── tests ├── EnvoyerTest.php └── ResourcesTest.php /.editorconfig: -------------------------------------------------------------------------------- 1 | # https://editorconfig.org/ 2 | 3 | root = true 4 | 5 | [*] 6 | trim_trailing_whitespace = true 7 | insert_final_newline = true 8 | end_of_line = lf 9 | charset = utf-8 10 | tab_width = 4 11 | 12 | [{*.{awk,bat,c,cpp,d,h,l,re,skl,w32,y},Makefile*}] 13 | indent_size = 4 14 | indent_style = tab 15 | 16 | [*.{dtd,html,inc,php,phpt,rng,wsdl,xml,xsd,xsl}] 17 | indent_size = 4 18 | indent_style = space 19 | 20 | [*.{ac,m4,sh,yml}] 21 | indent_size = 2 22 | indent_style = space 23 | 24 | [*.md] 25 | indent_style = space 26 | max_line_length = 80 27 | 28 | [COMMIT_EDITMSG] 29 | indent_size = 4 30 | indent_style = space 31 | max_line_length = 80 32 | 33 | [*.patch] 34 | trim_trailing_whitespace = false -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | /LICENSE export-ignore 2 | /README.md export-ignore 3 | /composer.lock export-ignore 4 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: [JustSteveKing] 4 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Desktop (please complete the following information):** 27 | - OS: [e.g. iOS] 28 | - Browser [e.g. chrome, safari] 29 | - Version [e.g. 22] 30 | 31 | **Smartphone (please complete the following information):** 32 | - Device: [e.g. iPhone6] 33 | - OS: [e.g. iOS8.1] 34 | - Browser [e.g. stock browser, safari] 35 | - Version [e.g. 22] 36 | 37 | **Additional context** 38 | Add any other context about the problem here. 39 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.github/workflows/php-cs-fixer.yml: -------------------------------------------------------------------------------- 1 | name: Code style 2 | 3 | on: [ push ] 4 | 5 | jobs: 6 | style: 7 | runs-on: ubuntu-latest 8 | 9 | steps: 10 | - name: Checkout code 11 | uses: actions/checkout@v2 12 | 13 | - name: Fix style 14 | uses: docker://oskarstark/php-cs-fixer-ga 15 | with: 16 | args: --config=.php_cs --allow-risky=yes 17 | 18 | - name: Extract branch name 19 | shell: bash 20 | run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" 21 | id: extract_branch 22 | 23 | - name: Commit changes 24 | uses: stefanzweifel/git-auto-commit-action@v2.3.0 25 | with: 26 | commit_message: Fix styling 27 | branch: ${{ steps.extract_branch.outputs.branch }} 28 | env: 29 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 30 | -------------------------------------------------------------------------------- /.github/workflows/tests.yml: -------------------------------------------------------------------------------- 1 | name: tests 2 | 3 | on: 4 | push: 5 | pull_request: 6 | 7 | jobs: 8 | linux_tests: 9 | runs-on: ubuntu-latest 10 | strategy: 11 | fail-fast: true 12 | matrix: 13 | php: [ 7.4 ] 14 | 15 | name: PHP ${{ matrix.php }} on Linux 16 | 17 | steps: 18 | - name: Checkout Code 19 | uses: actions/checkout@v2 20 | 21 | - name: Setup PHP 22 | uses: shivammathur/setup-php@v2 23 | with: 24 | php-version: ${{ matrix.php }} 25 | extensions: dom, curl, libxml, mbstring, zip, http 26 | tools: composer:v2 27 | coverage: none 28 | 29 | - name: Install dependencies 30 | run: composer install --no-interaction --prefer-dist 31 | 32 | - name: Execute tests 33 | run: vendor/bin/phpunit --verbose --coverage-clover=coverage.clover 34 | 35 | windows_tests: 36 | runs-on: windows-latest 37 | strategy: 38 | fail-fast: true 39 | matrix: 40 | php: [ 7.4 ] 41 | 42 | name: PHP ${{ matrix.php }} on Windows 43 | 44 | steps: 45 | 46 | - name: Set git to use LF 47 | run: | 48 | git config --global core.autocrlf false 49 | git config --global core.eol lf 50 | - name: Checkout code 51 | uses: actions/checkout@v2 52 | 53 | - name: Setup PHP 54 | uses: shivammathur/setup-php@v2 55 | with: 56 | php-version: ${{ matrix.php }} 57 | extensions: dom, curl, libxml, mbstring, zip, http 58 | tools: composer:v2 59 | coverage: none 60 | ini-values: memory_limit=512M 61 | 62 | - name: Install dependencies 63 | run: composer install --no-interaction --prefer-dist 64 | 65 | - name: Execute tests 66 | run: vendor/bin/phpunit --verbose 67 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /vendor/ 2 | /.idea/ 3 | /build/ 4 | /examples/ 5 | -------------------------------------------------------------------------------- /.php_cs: -------------------------------------------------------------------------------- 1 | notPath('vendor') 5 | ->in([ 6 | __DIR__ . '/src', 7 | __DIR__ . '/tests', 8 | ]) 9 | ->name('*.php') 10 | ->ignoreDotFiles(true) 11 | ->ignoreVCS(true); 12 | 13 | return PhpCsFixer\Config::create() 14 | ->setRules([ 15 | '@PSR2' => true, 16 | 'array_syntax' => ['syntax' => 'short'], 17 | 'ordered_imports' => ['sortAlgorithm' => 'alpha'], 18 | 'no_unused_imports' => true, 19 | 'not_operator_with_successor_space' => true, 20 | 'trailing_comma_in_multiline_array' => true, 21 | 'phpdoc_scalar' => true, 22 | 'unary_operator_spaces' => true, 23 | 'binary_operator_spaces' => true, 24 | 'blank_line_before_statement' => [ 25 | 'statements' => ['break', 'continue', 'declare', 'return', 'throw', 'try'], 26 | ], 27 | 'phpdoc_single_line_var_spacing' => true, 28 | 'phpdoc_var_without_name' => true, 29 | 'class_attributes_separation' => [ 30 | 'elements' => [ 31 | 'method', 'property', 32 | ], 33 | ], 34 | 'method_argument_space' => [ 35 | 'on_multiline' => 'ensure_fully_multiline', 36 | 'keep_multiple_spaces_after_comma' => true, 37 | ] 38 | ]) 39 | ->setFinder($finder); 40 | -------------------------------------------------------------------------------- /.php_cs.cache: -------------------------------------------------------------------------------- 1 | {"php":"7.4.14","version":"2.18.1","indent":" ","lineEnding":"\n","rules":{"blank_line_after_namespace":true,"braces":true,"class_definition":true,"constant_case":true,"elseif":true,"function_declaration":true,"indentation_type":true,"line_ending":true,"lowercase_keywords":true,"method_argument_space":{"on_multiline":"ensure_fully_multiline","keep_multiple_spaces_after_comma":true},"no_break_comment":true,"no_closing_tag":true,"no_spaces_after_function_name":true,"no_spaces_inside_parenthesis":true,"no_trailing_whitespace":true,"no_trailing_whitespace_in_comment":true,"single_blank_line_at_eof":true,"single_class_element_per_statement":{"elements":["property"]},"single_import_per_statement":true,"single_line_after_imports":true,"switch_case_semicolon_to_colon":true,"switch_case_space":true,"visibility_required":true,"encoding":true,"full_opening_tag":true,"array_syntax":{"syntax":"short"},"ordered_imports":{"sortAlgorithm":"alpha"},"no_unused_imports":true,"not_operator_with_successor_space":true,"trailing_comma_in_multiline_array":true,"phpdoc_scalar":true,"unary_operator_spaces":true,"binary_operator_spaces":true,"blank_line_before_statement":{"statements":["break","continue","declare","return","throw","try"]},"phpdoc_single_line_var_spacing":true,"phpdoc_var_without_name":true,"class_attributes_separation":{"elements":["method","property"]}},"hashes":{"src\/Envoyer.php":3651925640,"src\/Resources\/Collaborator.php":1973848660,"src\/Resources\/Deployment.php":618437535,"src\/Resources\/Action.php":1960997878,"src\/Resources\/Environment.php":2334510969,"src\/Resources\/EnvoyerResource.php":3816744812,"src\/Resources\/Server.php":3069790018,"src\/Resources\/Hook.php":3254347667,"src\/Resources\/Notification.php":3617218169,"src\/Resources\/Project.php":2503623812,"tests\/EnvoyerTest.php":668045118,"tests\/ResourcesTest.php":3789118063}} -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to making participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, sex characteristics, gender identity and expression, 9 | level of experience, education, socio-economic status, nationality, personal 10 | appearance, race, religion, or sexual identity and orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | * Using welcoming and inclusive language 18 | * Being respectful of differing viewpoints and experiences 19 | * Gracefully accepting constructive criticism 20 | * Focusing on what is best for the community 21 | * Showing empathy towards other community members 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | * The use of sexualized language or imagery and unwelcome sexual attention or 26 | advances 27 | * Trolling, insulting/derogatory comments, and personal or political attacks 28 | * Public or private harassment 29 | * Publishing others' private information, such as a physical or electronic 30 | address, without explicit permission 31 | * Other conduct which could reasonably be considered inappropriate in a 32 | professional setting 33 | 34 | ## Our Responsibilities 35 | 36 | Project maintainers are responsible for clarifying the standards of acceptable 37 | behavior and are expected to take appropriate and fair corrective action in 38 | response to any instances of unacceptable behavior. 39 | 40 | Project maintainers have the right and responsibility to remove, edit, or 41 | reject comments, commits, code, wiki edits, issues, and other contributions 42 | that are not aligned to this Code of Conduct, or to ban temporarily or 43 | permanently any contributor for other behaviors that they deem inappropriate, 44 | threatening, offensive, or harmful. 45 | 46 | ## Scope 47 | 48 | This Code of Conduct applies both within project spaces and in public spaces 49 | when an individual is representing the project or its community. Examples of 50 | representing a project or community include using an official project e-mail 51 | address, posting via an official social media account, or acting as an appointed 52 | representative at an online or offline event. Representation of a project may be 53 | further defined and clarified by project maintainers. 54 | 55 | ## Enforcement 56 | 57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 58 | reported by contacting the project team at juststevemcd@gmail.com. All 59 | complaints will be reviewed and investigated and will result in a response that 60 | is deemed necessary and appropriate to the circumstances. The project team is 61 | obligated to maintain confidentiality with regard to the reporter of an incident. 62 | Further details of specific enforcement policies may be posted separately. 63 | 64 | Project maintainers who do not follow or enforce the Code of Conduct in good 65 | faith may face temporary or permanent repercussions as determined by other 66 | members of the project's leadership. 67 | 68 | ## Attribution 69 | 70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 71 | available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html 72 | 73 | [homepage]: https://www.contributor-covenant.org 74 | 75 | For answers to common questions about this code of conduct, see 76 | https://www.contributor-covenant.org/faq 77 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "juststeveking/laravel-envoyer-sdk", 3 | "description": "A simple to use PHP class to work with the Laravel Envoyer API", 4 | "keywords": [ 5 | "laravel", 6 | "envoyer", 7 | "sdk" 8 | ], 9 | "type": "library", 10 | "license": "MIT", 11 | "authors": [ 12 | { 13 | "role": "developer", 14 | "name": "Steve McDougall", 15 | "email": "juststevemcd@gmail.com", 16 | "homepage": "https://www.juststeveking.uk/" 17 | } 18 | ], 19 | "require": { 20 | "php": "^7.4|^8.0", 21 | "ext-json": "*", 22 | "juststeveking/http-auth-strategies": "^1.1", 23 | "juststeveking/http-slim": "^1.2", 24 | "juststeveking/php-sdk": "^1.1", 25 | "juststeveking/uri-builder": "^1.1", 26 | "nyholm/psr7": "^1.3", 27 | "php-di/php-di": "^6.3", 28 | "symfony/http-client": "^5.1" 29 | }, 30 | "require-dev": { 31 | "php-http/mock-client": "^1.4", 32 | "phpunit/phpunit": "^9.4", 33 | "symfony/var-dumper": "^5.1" 34 | }, 35 | "autoload": { 36 | "psr-4": { 37 | "JustSteveKing\\Laravel\\Envoyer\\SDK\\": "src/" 38 | } 39 | }, 40 | "autoload-dev": { 41 | "psr-4": { 42 | "JustSteveKing\\Laravel\\Envoyer\\SDK\\Tests\\": "tests/" 43 | } 44 | }, 45 | "config": { 46 | "sort-packages": true 47 | }, 48 | "minimum-stability": "dev", 49 | "prefer-stable": true 50 | } 51 | -------------------------------------------------------------------------------- /laravel-envoyer-sdk.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JustSteveKing/laravel-envoyer-sdk/864c10ca883be98243bc163efb1cbcf460bd0bb2/laravel-envoyer-sdk.png -------------------------------------------------------------------------------- /phpunit.xml.dist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | ./src 6 | 7 | 8 | 9 | 10 | ./tests 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/Envoyer.php: -------------------------------------------------------------------------------- 1 | addResource('hooks', new Hook()); 57 | $client->addResource('actions', new Action()); 58 | $client->addResource('servers', new Server()); 59 | $client->addResource('projects', new Project()); 60 | $client->addResource('deployments', new Deployment()); 61 | $client->addResource('environments', new Environment()); 62 | $client->addResource('collaborators', new Collaborator()); 63 | $client->addResource('notifications', new Notification()); 64 | 65 | return $client; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /src/Resources/Action.php: -------------------------------------------------------------------------------- 1 | get()->getBody()->getContents(), 15 | false 16 | ); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/Resources/Collaborator.php: -------------------------------------------------------------------------------- 1 | http()->post( 13 | $this->uri()->toString(), 14 | $data, 15 | $this->strategy()->getHeader($this->authHeader) 16 | ); 17 | // @codeCoverageIgnoreStart 18 | } catch (\Exception $e) { 19 | throw $e; 20 | } 21 | // @codeCoverageIgnoreEnd 22 | 23 | return \json_decode( 24 | $response->getBody()->getContents(), 25 | false 26 | ); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Resources/Deployment.php: -------------------------------------------------------------------------------- 1 | http()->post( 13 | $this->uri()->toString(), 14 | $payload, 15 | $this->strategy()->getHeader($this->authHeader) 16 | ); 17 | // @codeCoverageIgnoreStart 18 | } catch (\Exception $e) { 19 | throw $e; 20 | } 21 | // @codeCoverageIgnoreEnd 22 | 23 | return \json_decode( 24 | $response->getBody()->getContents(), 25 | false 26 | ); 27 | } 28 | 29 | public function cancel($identifier):? object 30 | { 31 | $this->uri()->addPath( 32 | "{$this->uri()->path()}/{$identifier}" 33 | ); 34 | 35 | try { 36 | $response = $this->http()->post( 37 | $this->uri()->toString(), 38 | [], 39 | $this->strategy()->getHeader($this->authHeader) 40 | ); 41 | // @codeCoverageIgnoreStart 42 | } catch (\Exception $e) { 43 | throw $e; 44 | } 45 | // @codeCoverageIgnoreEnd 46 | 47 | return \json_decode( 48 | $response->getBody()->getContents(), 49 | false 50 | ); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/Resources/Environment.php: -------------------------------------------------------------------------------- 1 | key = (string) $key; 16 | $this->uri()->addQueryParam('key', $key); 17 | 18 | return $this; 19 | } 20 | 21 | public function servers():? object 22 | { 23 | $this->uri()->addPath( 24 | "{$this->uri()->path()}/servers" 25 | ); 26 | 27 | return \json_decode( 28 | $this->get()->getBody()->getContents(), 29 | false 30 | ); 31 | } 32 | 33 | public function onServer(...$servers): self 34 | { 35 | $this->servers = $servers; 36 | 37 | return $this; 38 | } 39 | 40 | public function put(...$data):? object 41 | { 42 | $data = array_merge([ 43 | 'key' => $this->key, 44 | ], [ 45 | 'contents' => implode("\n", $data), 46 | ]); 47 | 48 | if (! empty($this->servers)) { 49 | $data['servers'] = array_values($this->servers); 50 | } 51 | 52 | $response = $this->http->put( 53 | $this->uri->toString(), 54 | $data, 55 | $this->strategy()->getHeader($this->authHeader) 56 | ); 57 | 58 | return \json_decode( 59 | $response->getBody()->getContents(), 60 | false 61 | ); 62 | } 63 | 64 | public function reset($key):? object 65 | { 66 | $this->uri()->addQueryParam('key', (string) $key); 67 | 68 | try { 69 | $response = $this->http()->delete( 70 | $this->uri()->toString(), 71 | $this->strategy()->getHeader($this->authHeader) 72 | ); 73 | // @codeCoverageIgnoreStart 74 | } catch (\Exception $e) { 75 | throw $e; 76 | } 77 | // @codeCoverageIgnoreEnd 78 | 79 | return \json_decode( 80 | $response->getBody()->getContents(), 81 | false 82 | ); 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /src/Resources/EnvoyerResource.php: -------------------------------------------------------------------------------- 1 | uri()->addPath( 23 | "api/projects/{$project}/{$this->path}" 24 | ); 25 | 26 | $this->project = (string) $project; 27 | 28 | return $this; 29 | } 30 | 31 | /** 32 | * Get all Resources 33 | * 34 | * @return object|null 35 | */ 36 | public function all():? object 37 | { 38 | return \json_decode( 39 | $this->get()->getBody()->getContents(), 40 | false 41 | ); 42 | } 43 | 44 | /** 45 | * Save a new Resource 46 | * 47 | * @param array $data 48 | * @return object|null 49 | * @throws \Psr\Http\Client\ClientExceptionInterface 50 | */ 51 | public function save(array $data):? object 52 | { 53 | return \json_decode( 54 | $this->create($data)->getBody()->getContents(), 55 | false 56 | ); 57 | } 58 | 59 | /** 60 | * Get the first Resource with an identifier 61 | * 62 | * @param mixed $identifier 63 | * @return object|null 64 | */ 65 | public function first($identifier):? object 66 | { 67 | return \json_decode( 68 | $this->find($identifier)->getBody()->getContents(), 69 | false 70 | ); 71 | } 72 | 73 | public function modify($identifier, array $data):? object 74 | { 75 | $this->uri()->addPath( 76 | "{$this->uri()->path()}/{$identifier}" 77 | ); 78 | 79 | try { 80 | $response = $this->http()->put( 81 | $this->uri()->toString(), 82 | $data, 83 | $this->strategy()->getHeader($this->authHeader) 84 | ); 85 | // @codeCoverageIgnoreStart 86 | } catch (\Exception $e) { 87 | throw $e; 88 | } 89 | // @codeCoverageIgnoreEnd; 90 | 91 | return \json_decode( 92 | $response->getBody()->getContents(), 93 | false 94 | ); 95 | } 96 | 97 | public function remove($identifier = null):? object 98 | { 99 | if (! is_null($identifier)) { 100 | $this->uri()->addPath( 101 | "{$this->uri()->path()}/{$identifier}" 102 | ); 103 | } 104 | 105 | try { 106 | $response = $this->http()->delete( 107 | $this->uri()->toString(), 108 | $this->strategy()->getHeader($this->authHeader) 109 | ); 110 | // @codeCoverageIgnoreStart 111 | } catch (\Exception $e) { 112 | throw $e; 113 | } 114 | // @codeCoverageIgnoreEnd 115 | 116 | return \json_decode( 117 | $response->getBody()->getContents(), 118 | false 119 | ); 120 | } 121 | } 122 | -------------------------------------------------------------------------------- /src/Resources/Hook.php: -------------------------------------------------------------------------------- 1 | uri()->addPath( 12 | "{$this->uri()->path()}/{$identifier}/source" 13 | ); 14 | 15 | try { 16 | $response = $this->http()->put( 17 | $this->uri()->toString(), 18 | $data, 19 | $this->strategy()->getHeader($this->authHeader) 20 | ); 21 | // @codeCoverageIgnoreStart 22 | } catch (\Exception $e) { 23 | throw $e; 24 | } 25 | // @codeCoverageIgnoreEnd; 26 | return \json_decode( 27 | $response->getBody()->getContents(), 28 | false 29 | ); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Resources/Server.php: -------------------------------------------------------------------------------- 1 | assertInstanceOf( 17 | Envoyer::class, 18 | $client 19 | ); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /tests/ResourcesTest.php: -------------------------------------------------------------------------------- 1 | client = Envoyer::illuminate('1234'); 19 | $this->client->addResource('actions', new Action()); 20 | $this->client->actions->setHttp( 21 | HttpClient::build( 22 | new \Http\Mock\Client(), 23 | new Psr18Client(), 24 | new Psr18Client() 25 | ) 26 | ); 27 | } 28 | 29 | /** 30 | * @test 31 | */ 32 | public function it_can_get_all_actions() 33 | { 34 | $this->client->actions->all(); 35 | } 36 | 37 | /** 38 | * @test 39 | */ 40 | public function it_can_invite_a_collaborator() 41 | { 42 | $this->client->collaborators->on(10)->invite(['email' => 'test@email.com']); 43 | } 44 | 45 | /** 46 | * @test 47 | */ 48 | public function it_can_deploy_and_cancel_a_deployment() 49 | { 50 | $this->client->deployments->on(10)->deploy(); 51 | $this->client->deployments->on(10)->cancel(1); 52 | } 53 | 54 | /** 55 | * @test 56 | */ 57 | public function it_can_work_with_environments() 58 | { 59 | $this->assertEquals( 60 | '1234', 61 | $this->client->environments->on(10)->key('1234')->uri()->query()->get('key') 62 | ); 63 | 64 | $this->client->environments->on(10)->onServer(1)->put('test=this'); 65 | $this->client->environments->on(10)->servers(); 66 | $this->client->environments->on(10)->reset('1234'); 67 | } 68 | 69 | /** 70 | * @test 71 | */ 72 | public function it_can_work_with_projects() 73 | { 74 | $this->client->projects->all(); 75 | $this->client->projects->save(['test' => 'body']); 76 | $this->client->projects->first(1); 77 | $this->client->projects->modify(1, ['foo' => 'bar']); 78 | $this->client->projects->remove(1); 79 | } 80 | } 81 | --------------------------------------------------------------------------------