From 2be762ee37396188e7f4f83eb2af4893a821ea08 Mon Sep 17 00:00:00 2001 From: Mark Walet Date: Wed, 4 Dec 2019 14:38:13 +0100 Subject: [PATCH 1/6] Add a remote url transformer --- src/Support/RemoteUrlTransformer.php | 33 ++++++++ tests/Support/RemoteUrlTransformerTest.php | 89 ++++++++++++++++++++++ 2 files changed, 122 insertions(+) create mode 100644 src/Support/RemoteUrlTransformer.php create mode 100644 tests/Support/RemoteUrlTransformerTest.php diff --git a/src/Support/RemoteUrlTransformer.php b/src/Support/RemoteUrlTransformer.php new file mode 100644 index 0000000..06bb0b7 --- /dev/null +++ b/src/Support/RemoteUrlTransformer.php @@ -0,0 +1,33 @@ +assertEquals('github.com/markwalet/laravel-git-state', $result); + } + + /** @test */ + public function it_removes_the_http_prefix_if_present() + { + $url = 'http://github.com/markwalet/laravel-git-state'; + + $result = RemoteUrlTransformer::transform($url); + + $this->assertEquals('github.com/markwalet/laravel-git-state', $result); + } + + /** @test */ + public function it_removes_the_https_prefix_if_present() + { + $url = 'https://github.com/markwalet/laravel-git-state'; + + $result = RemoteUrlTransformer::transform($url); + + $this->assertEquals('github.com/markwalet/laravel-git-state', $result); + } + + /** @test */ + public function it_removes_the_git_appendix_if_present() + { + $url = 'https://github.com/markwalet/laravel-git-state.git'; + + $result = RemoteUrlTransformer::transform($url); + + $this->assertEquals('github.com/markwalet/laravel-git-state', $result); + } + + /** @test */ + public function it_removes_the_ssh_user_if_present() + { + $url = 'git@github.com/markwalet/laravel-git-state'; + + $result = RemoteUrlTransformer::transform($url); + + $this->assertEquals('github.com/markwalet/laravel-git-state', $result); + } + + /** @test */ + public function it_replaces_semi_colons_with_forward_slashes() + { + $url = 'github.com:markwalet/laravel-git-state'; + + $result = RemoteUrlTransformer::transform($url); + + $this->assertEquals('github.com/markwalet/laravel-git-state', $result); + } + + /** @test */ + public function it_can_format_gitlab_ssh_remotes() + { + $url = 'git@gitlab.com:gitlab-org/gitlab-foss.git'; + + $result = RemoteUrlTransformer::transform($url); + + $this->assertEquals('gitlab.com/gitlab-org/gitlab-foss', $result); + } + + /** @test */ + public function it_can_format_gitlab_http_remotes() + { + $url = 'https://gitlab.com/gitlab-org/gitlab-foss.git'; + + $result = RemoteUrlTransformer::transform($url); + + $this->assertEquals('gitlab.com/gitlab-org/gitlab-foss', $result); + } +} From 311ab8077975374298d2a42eea81b299c57679f3 Mon Sep 17 00:00:00 2001 From: Mark Walet Date: Wed, 11 Mar 2020 13:41:09 +0100 Subject: [PATCH 2/6] Update composer dependencies --- composer.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index dfff49c..9d566a6 100644 --- a/composer.json +++ b/composer.json @@ -13,12 +13,12 @@ ], "require": { "php": ">=7.1.3", - "illuminate/contracts": "~5.5|6.*", - "illuminate/support": "~5.5|6.*" + "illuminate/contracts": "~5.5|6.*|7.*", + "illuminate/support": "~5.5|6.*|7.*" }, "require-dev": { "phpunit/phpunit": "~6.0||~7.0||~8.0", - "orchestra/testbench": "~3.5|4.*" + "orchestra/testbench": "~3.5|4.*|5.*" }, "autoload": { "psr-4": { From 85c834a675276ed77b2bb14762e7389f4c02322f Mon Sep 17 00:00:00 2001 From: Mark Walet Date: Wed, 11 Mar 2020 13:41:17 +0100 Subject: [PATCH 3/6] Update travis configuration --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index 0de4b74..6e0a7ba 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,11 +15,14 @@ env: - ILLUMINATE_VERSION=5.5.* PHPUNIT_VERSION=~6.0 TESTBENCH_VERSION=3.5.* - ILLUMINATE_VERSION=5.8.* PHPUNIT_VERSION=^7.5 TESTBENCH_VERSION=3.8.* - ILLUMINATE_VERSION=6.* PHPUNIT_VERSION=^8.0 TESTBENCH_VERSION=4.* + - ILLUMINATE_VERSION=7.* PHPUNIT_VERSION=^8.5 TESTBENCH_VERSION=5.* matrix: exclude: - php: 7.1 env: ILLUMINATE_VERSION=6.* PHPUNIT_VERSION=^8.0 TESTBENCH_VERSION=4.* + - php: 7.1 + env: ILLUMINATE_VERSION=7.* PHPUNIT_VERSION=^8.5 TESTBENCH_VERSION=5.* before_install: # Update requirements to fit environment variables. - composer require "illuminate/contracts:${ILLUMINATE_VERSION}" --no-update --prefer-dist From d6551130e5ec063ace7f6d13bae748565d1b6d84 Mon Sep 17 00:00:00 2001 From: Mark Walet Date: Wed, 11 Mar 2020 13:44:17 +0100 Subject: [PATCH 4/6] Update changelog --- CHANGELOG.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8aeb199..1c5800d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,11 +2,14 @@ ## [Unreleased](https://github.com/markwalet/laravel-git-state/compare/v1.1.0...master) +### Added +- Add support for Laravel 7. ([#9](https://github.com/markwalet/laravel-git-state/issues/9)) + ## [v1.1.0 (2019-10-10)](https://github.com/markwalet/laravel-git-state/compare/v1.0.6...v1.1.0) ### Added - Added Codecov integration. -- Added support for Laravel 6. +- Added support for Laravel 6. ([#8](https://github.com/markwalet/laravel-git-state/issues/8)) ### Removed - Removed Coveralls integration. From 66015681ed0989913dd7d4ac3932baceb1da4f96 Mon Sep 17 00:00:00 2001 From: Mark Walet Date: Wed, 11 Mar 2020 13:45:23 +0100 Subject: [PATCH 5/6] Fix styleCI configuration --- .styleci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.styleci.yml b/.styleci.yml index 57a216f..1b5cad7 100644 --- a/.styleci.yml +++ b/.styleci.yml @@ -2,5 +2,4 @@ preset: laravel enabled: - alpha_ordered_imports disabled: - - length_ordered_imports - simplified_null_return From 4945484b2c57dcc1dc00ac9e6a7612c06d1e21cf Mon Sep 17 00:00:00 2001 From: Mark Walet Date: Wed, 11 Mar 2020 13:46:05 +0100 Subject: [PATCH 6/6] Fix styleCI configuration --- .styleci.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.styleci.yml b/.styleci.yml index 1b5cad7..fe65658 100644 --- a/.styleci.yml +++ b/.styleci.yml @@ -1,5 +1,3 @@ preset: laravel -enabled: - - alpha_ordered_imports disabled: - simplified_null_return