diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml new file mode 100644 index 0000000..97606a0 --- /dev/null +++ b/.github/workflows/run-tests.yml @@ -0,0 +1,37 @@ +name: Tests + +on: [push, pull_request] + +jobs: + test: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: true + matrix: + os: [ubuntu-latest, windows-latest] + php: [8.0, 7.4] + stability: [prefer-lowest, prefer-stable] + + name: P${{ matrix.php }} - ${{ matrix.stability }} - ${{ matrix.os }} + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo + coverage: none + + - name: Setup problem matchers + run: | + echo "::add-matcher::${{ runner.tool_cache }}/php.json" + echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" + + - name: Install dependencies + run: composer update --${{ matrix.stability }} --prefer-dist --no-interaction + + - name: Execute tests + run: vendor/bin/phpunit diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 52e906a..0000000 --- a/.travis.yml +++ /dev/null @@ -1,31 +0,0 @@ -language: php - -php: - - 5.6 - - 7.0 - - 7.1 - -sudo: false - -cache: - directories: - - $HOME/.composer/cache - -matrix: - include: - - php: 5.6 - env: 'COMPOSER_FLAGS="--prefer-stable --prefer-lowest"' - -before_script: - - travis_retry composer self-update - - travis_retry composer update ${COMPOSER_FLAGS} --no-interaction --prefer-dist - -script: - - vendor/bin/phpcs - - vendor/bin/phpunit --coverage-text --coverage-clover=clover.xml - -after_script: - - travis_retry php vendor/bin/coveralls --coverage_clover=clover.xml - -notifications: - email: false diff --git a/CHANGELOG.md b/CHANGELOG.md index d63df34..82d9cfe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,19 +4,12 @@ All Notable changes to `geekish/faker-horse-battery-staple` will be documented i Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) principles. +## 2.0 - 2020-12-20 + +### Changed +- Switched to successor `fakerphp/faker`. + ## 1.0 - 2016-11-14 ### Added - Faker provider using `yuloh/battery-staple`. - -### Deprecated -- Nothing - -### Fixed -- Nothing - -### Removed -- Nothing - -### Security -- Nothing diff --git a/composer.json b/composer.json index af02508..54904f5 100644 --- a/composer.json +++ b/composer.json @@ -18,12 +18,12 @@ } ], "require": { - "php": "^5.6|^7.0", - "fzaninotto/faker": "^1.6", + "php": "^7.1|^8.0", + "fakerphp/faker": "^1.9", "yuloh/battery-staple": "^1.0" }, "require-dev": { - "phpunit/phpunit": "^5.7|^6.0", + "phpunit/phpunit": "^7.5.20 || ^8.5.8 || ^9.4.2", "squizlabs/php_codesniffer": "^3.0" }, "autoload": { diff --git a/phpunit.xml.dist b/phpunit.xml.dist index dc13bc6..242420f 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -14,16 +14,17 @@ <directory>tests</directory> </testsuite> </testsuites> - <filter> - <whitelist> - <directory suffix=".php">src/</directory> - </whitelist> - </filter> + <coverage> + <include> + <directory suffix=".php">./src</directory> + </include> + <report> + <html outputDirectory="build/coverage"/> + <text outputFile="build/coverage.txt"/> + <clover outputFile="build/logs/clover.xml"/> + </report> + </coverage> <logging> - <log type="tap" target="build/report.tap"/> - <log type="junit" target="build/report.junit.xml"/> - <log type="coverage-html" target="build/coverage" charset="UTF-8" yui="true" highlight="true"/> - <log type="coverage-text" target="build/coverage.txt"/> - <log type="coverage-clover" target="build/logs/clover.xml"/> + <junit outputFile="build/report.junit.xml"/> </logging> </phpunit> diff --git a/src/BatteryStapleProvider.php b/src/BatteryStapleProvider.php index 290ae13..785e8c1 100644 --- a/src/BatteryStapleProvider.php +++ b/src/BatteryStapleProvider.php @@ -10,7 +10,7 @@ */ class BatteryStapleProvider extends BaseProvider { - public function correctHorseBatteryStaple($delimiter = '') + public function correctHorseBatteryStaple($delimiter = ''): string { return PasswordGenerator::generate($delimiter); } diff --git a/tests/BatteryStapleProviderTest.php b/tests/BatteryStapleProviderTest.php index 6d3e22d..a53b2ab 100644 --- a/tests/BatteryStapleProviderTest.php +++ b/tests/BatteryStapleProviderTest.php @@ -15,7 +15,7 @@ class BatteryStapleProviderTest extends TestCase /** * Set up Faker Generator with BatteryStapleProvider */ - public function setUp() + protected function setUp(): void { $faker = new Generator; $faker->addProvider(new BatteryStapleProvider($faker)); @@ -37,6 +37,6 @@ public function testNotEmpty() public function testGenerateWithDelimiter() { $password = $this->faker->correctHorseBatteryStaple('.'); - $this->assertRegExp('/((\w+)\.(\w+)\.(\w+)\.(\w+))/', $password); + $this->assertMatchesRegularExpression('/((\w+)\.(\w+)\.(\w+)\.(\w+))/', $password); } }