-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #105 from shlinkio/develop
Release 5.4.0
- Loading branch information
Showing
13 changed files
with
305 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
name: Continuous integration | ||
|
||
on: | ||
pull_request: null | ||
push: | ||
branches: | ||
- develop | ||
- main | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-20.04 | ||
strategy: | ||
matrix: | ||
php-version: ['7.4'] | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Use PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php-version }} | ||
tools: composer | ||
coverage: none | ||
- run: composer install --no-interaction --prefer-dist | ||
- run: composer cs | ||
|
||
static-analysis: | ||
runs-on: ubuntu-20.04 | ||
strategy: | ||
matrix: | ||
php-version: ['7.4'] | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Use PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php-version }} | ||
tools: composer | ||
coverage: none | ||
- run: composer install --no-interaction --prefer-dist | ||
- run: composer stan | ||
|
||
unit-tests: | ||
runs-on: ubuntu-20.04 | ||
strategy: | ||
matrix: | ||
php-version: ['7.4', '8.0'] | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Use PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php-version }} | ||
tools: composer | ||
coverage: none | ||
- if: ${{ matrix.php-version == '8.0' }} | ||
run: composer install --no-interaction --prefer-dist --ignore-platform-req=php | ||
- if: ${{ matrix.php-version != '8.0' }} | ||
run: composer install --no-interaction --prefer-dist | ||
- run: composer test:ci | ||
- uses: actions/upload-artifact@v2 | ||
with: | ||
name: build-${{ matrix.php-version }} | ||
path: build | ||
|
||
mutation-tests: | ||
needs: | ||
- unit-tests | ||
runs-on: ubuntu-20.04 | ||
strategy: | ||
matrix: | ||
php-version: ['7.4', '8.0'] | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Use PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php-version }} | ||
tools: composer | ||
coverage: none | ||
- if: ${{ matrix.php-version == '8.0' }} | ||
run: composer install --no-interaction --prefer-dist --ignore-platform-req=php | ||
- if: ${{ matrix.php-version != '8.0' }} | ||
run: composer install --no-interaction --prefer-dist | ||
- uses: actions/download-artifact@v2 | ||
with: | ||
name: build-${{ matrix.php-version }} | ||
path: build | ||
- run: composer infect:ci | ||
|
||
upload-coverage: | ||
needs: | ||
- unit-tests | ||
runs-on: ubuntu-20.04 | ||
strategy: | ||
matrix: | ||
php-version: ['7.4'] | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Use PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php-version }} | ||
coverage: pcov | ||
- uses: actions/download-artifact@v2 | ||
with: | ||
name: build-${{ matrix.php-version }} | ||
path: build | ||
- name: Publish coverage | ||
uses: codecov/codecov-action@v1 | ||
with: | ||
file: ./build/clover.xml | ||
|
||
delete-artifacts: | ||
needs: | ||
- mutation-tests | ||
- upload-coverage | ||
runs-on: ubuntu-20.04 | ||
strategy: | ||
matrix: | ||
php-version: ['7.4', '8.0'] | ||
steps: | ||
- uses: geekyeggo/delete-artifact@v1 | ||
with: | ||
name: build-${{ matrix.php-version }} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
src/Config/Option/UrlShortener/AutoResolveTitlesConfigOption.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Shlinkio\Shlink\Installer\Config\Option\UrlShortener; | ||
|
||
use Shlinkio\Shlink\Config\Collection\PathCollection; | ||
use Shlinkio\Shlink\Installer\Config\Option\BaseConfigOption; | ||
use Symfony\Component\Console\Style\StyleInterface; | ||
|
||
class AutoResolveTitlesConfigOption extends BaseConfigOption | ||
{ | ||
public function getConfigPath(): array | ||
{ | ||
return ['url_shortener', 'auto_resolve_titles']; | ||
} | ||
|
||
public function ask(StyleInterface $io, PathCollection $currentOptions): bool | ||
{ | ||
return $io->confirm( | ||
'Do you want Shlink to resolve the short URL title based on the long URL \'s title tag (if any)? ' | ||
. 'Otherwise, it will be kept empty unless explicitly provided.', | ||
false, | ||
); | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
src/Config/Option/UrlShortener/OrphanVisitsTrackingConfigOption.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Shlinkio\Shlink\Installer\Config\Option\UrlShortener; | ||
|
||
use Shlinkio\Shlink\Config\Collection\PathCollection; | ||
use Shlinkio\Shlink\Installer\Config\Option\BaseConfigOption; | ||
use Symfony\Component\Console\Style\StyleInterface; | ||
|
||
class OrphanVisitsTrackingConfigOption extends BaseConfigOption | ||
{ | ||
public function getConfigPath(): array | ||
{ | ||
return ['url_shortener', 'track_orphan_visits']; | ||
} | ||
|
||
public function ask(StyleInterface $io, PathCollection $currentOptions): bool | ||
{ | ||
return $io->confirm( | ||
'Do you want track orphan visits? (visits to the base URL, invalid short URLs or other "not found" URLs)', | ||
true, | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
test/Config/Option/UrlShortener/AutoResolveTitlesConfigOptionTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace ShlinkioTest\Shlink\Installer\Config\Option\UrlShortener; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use Prophecy\PhpUnit\ProphecyTrait; | ||
use Shlinkio\Shlink\Config\Collection\PathCollection; | ||
use Shlinkio\Shlink\Installer\Config\Option\UrlShortener\AutoResolveTitlesConfigOption; | ||
use Symfony\Component\Console\Style\StyleInterface; | ||
|
||
class AutoResolveTitlesConfigOptionTest extends TestCase | ||
{ | ||
use ProphecyTrait; | ||
|
||
private AutoResolveTitlesConfigOption $configOption; | ||
|
||
public function setUp(): void | ||
{ | ||
$this->configOption = new AutoResolveTitlesConfigOption(); | ||
} | ||
|
||
/** @test */ | ||
public function returnsExpectedConfig(): void | ||
{ | ||
self::assertEquals(['url_shortener', 'auto_resolve_titles'], $this->configOption->getConfigPath()); | ||
} | ||
|
||
/** @test */ | ||
public function expectedQuestionIsAsked(): void | ||
{ | ||
$expectedAnswer = true; | ||
$io = $this->prophesize(StyleInterface::class); | ||
$confirm = $io->confirm( | ||
'Do you want Shlink to resolve the short URL title based on the long URL \'s title tag (if any)? ' | ||
. 'Otherwise, it will be kept empty unless explicitly provided.', | ||
false, | ||
)->willReturn( | ||
$expectedAnswer, | ||
); | ||
|
||
$answer = $this->configOption->ask($io->reveal(), new PathCollection()); | ||
|
||
self::assertEquals($expectedAnswer, $answer); | ||
$confirm->shouldHaveBeenCalledOnce(); | ||
} | ||
} |
Oops, something went wrong.