Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 52 #1

Merged
merged 33 commits into from
Feb 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
f9a7ea9
Bug fix for php 8.2.2
fr3nch13 Feb 16, 2023
f1244bd
Update ci.yml
fr3nch13 Feb 16, 2023
b884833
Updating package requirements and github actions.
fr3nch13 Feb 16, 2023
f75c5cd
CS Updates
fr3nch13 Feb 16, 2023
7465f10
Update ci.yml
fr3nch13 Feb 16, 2023
ba29d1e
See if this will work for php 5.x
fr3nch13 Feb 16, 2023
8177f1c
Closer to being compatible with 5.x -> 8.x
fr3nch13 Feb 16, 2023
c2079f7
It didn't like the '_' prefix.
fr3nch13 Feb 16, 2023
bae6a08
Trying to be compatible with more phpunit versions.
fr3nch13 Feb 16, 2023
e9ddfb3
Update LoaderTest.php
fr3nch13 Feb 16, 2023
8ae90f8
Update LoaderTest.php
fr3nch13 Feb 16, 2023
c43cb9c
Forgot to remove that.
fr3nch13 Feb 16, 2023
f8e80be
Update ci.yml
fr3nch13 Feb 16, 2023
fc6159d
Trying to get coverage to work
fr3nch13 Feb 16, 2023
f64de7e
Minor updates to the testing.
fr3nch13 Feb 16, 2023
6a320f9
Maybe a caching issue?
fr3nch13 Feb 16, 2023
c058600
See if it's failing elsewhere.
fr3nch13 Feb 16, 2023
a4ac20b
Should fix issue with variables already set.
fr3nch13 Feb 16, 2023
1546faa
Try this for phpunit 8
fr3nch13 Feb 16, 2023
d8e74c4
Update phpunit.xml
fr3nch13 Feb 16, 2023
a6af278
From the original config.
fr3nch13 Feb 16, 2023
f4d6156
Will fail, but testing something.
fr3nch13 Feb 16, 2023
585dbc9
See if we can use php-specific configs.
fr3nch13 Feb 16, 2023
d299310
Adding coverage
fr3nch13 Feb 16, 2023
4960665
Adding for specific phpunit testing.
fr3nch13 Feb 16, 2023
9a7ce78
Fix config warning for 7.x
fr3nch13 Feb 16, 2023
93e4d8b
So codecov can find the coverage report.
fr3nch13 Feb 16, 2023
87b2030
Allow codecov
fr3nch13 Feb 16, 2023
071b8c0
Merge branch 'master' into issue-52
fr3nch13 Feb 17, 2023
e8ed8e5
Seems like no real changes.
fr3nch13 Feb 17, 2023
8091e60
Revert "Seems like no real changes."
fr3nch13 Feb 17, 2023
a58894e
Revert "Merge branch 'master' into issue-52"
fr3nch13 Feb 17, 2023
cb75cfc
Don't loose support for php 5.
fr3nch13 Feb 17, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 23 additions & 47 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ on:
- '*'
push:
branches:
- master
- '*'

permissions:
contents: read

jobs:
test:
coding-standard:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
php-version: ['7.2', '7.4', '8.0', '8.1', '8.2']
name: Test PHP ${{ matrix.php-version }}
php-version: ['5.5', '5.6', '7.1', '7.2', '7.4', '8.0', '8.1', '8.2']
name: Coding Standard ${{ matrix.php-version }}

steps:
- uses: actions/checkout@v3
Expand All @@ -33,16 +33,16 @@ jobs:
- name: Composer install
run: composer install

- name: Run PHPUnit
run: composer run-script test
coverage-php:
- name: Run PHP CodeSniffer
run: composer run-script cs-check

test:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
php-version: ['7.2', '7.4', '8.0', '8.1', '8.2']
name: Coverage PHP ${{ matrix.php-version }}
php-version: ['5.5', '5.6', '7.1', '7.2', '7.4', '8.0', '8.1', '8.2']
name: Test PHP ${{ matrix.php-version }}

steps:
- uses: actions/checkout@v3
Expand All @@ -52,28 +52,21 @@ jobs:
with:
php-version: ${{ matrix.php-version }}
extensions: mbstring, intl
coverage: pcov
coverage: none

- name: Composer install
run: composer install

- name: Run PHPUnit
run: composer run-script coverage-clover

- name: Upload to Codecov
uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODE_COV_TOKEN }}
files: ./tmp/coverage.xml
verbose: true
run: composer run-script test-${{ matrix.php-version }}

coding-standard:
coverage-php:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
php-version: ['7.2', '7.4', '8.0', '8.1', '8.2']
name: Coding Standard ${{ matrix.php-version }}
php-version: ['5.5', '5.6', '7.2', '7.4', '8.0', '8.1', '8.2'] # removed 7.1 as it seems to have an issue with no code coverage driver.
name: Coverage PHP ${{ matrix.php-version }}

steps:
- uses: actions/checkout@v3
Expand All @@ -83,34 +76,17 @@ jobs:
with:
php-version: ${{ matrix.php-version }}
extensions: mbstring, intl
coverage: none
coverage: pcov

- name: Composer install
run: composer install

- name: Run PHP CodeSniffer
run: composer run-script cs-checkstyle | vendor/bin/cs2pr

static-analysis:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
php-version: ['7.2', '7.4', '8.0', '8.1', '8.2']
name: Static Analysis - PHP ${{ matrix.php-version }}

steps:
- uses: actions/checkout@v3
- name: Run PHPUnit
run: composer run-script coverage-${{ matrix.php-version }}

- name: Setup PHP
uses: shivammathur/setup-php@v2
- name: Upload to Codecov
uses: codecov/codecov-action@v3
with:
php-version: ${{ matrix.php-version }}
extensions: mbstring, intl
coverage: none

- name: Composer install
run: composer install

- name: Run PHP Analyzer
run: composer run-script phpstan-github
token: ${{ secrets.CODECOV_TOKEN }}
files: ./tmp/coverage.xml
verbose: true
9 changes: 7 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
.DS_Store
build
composer.lock
tmp
tmp/*
!tmp/.gitkeep
vendor
.phpunit.result.cache
.phpunit.result.cache
/.phpunit.cache
coverage.xml
unitreport.xml
.vscode
File renamed without changes.
17 changes: 4 additions & 13 deletions README.md → README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,20 @@ A `.env` file parsing and loading library for PHP.

## Requirements

* PHP 5.5+|7.2+
* PHP 5.5+

## Installation

_[Using [Composer](http://getcomposer.org/)]_

Run `composer require josegonzalez/dotenv`
Run `composer require josegonzalez/dotenv:dev-master`

Or add the plugin to your project's `composer.json` - something like this:

For php 5.5 -> 7.4
```json
```javascript
{
"require": {
"josegonzalez/dotenv": ~3.2"
}
}
```
For php 7.4 -> 8.2+
```json
{
"require": {
"josegonzalez/dotenv": ~4.0"
"josegonzalez/dotenv": "dev-master"
}
}
```
Expand Down
44 changes: 31 additions & 13 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,9 @@
"m1/env": "2.*"
},
"require-dev": {
"php": ">=7",
"squizlabs/php_codesniffer": "2.*|3.*",
"php-coveralls/php-coveralls": "~2.5",
"php-mock/php-mock-phpunit": "~2.6",
"phpstan/phpstan": "^1.9",
"staabm/annotate-pull-request-from-checkstyle": "^1.8"
"squizlabs/php_codesniffer": "~2.9||~3.7",
"php-coveralls/php-coveralls": "~2.0",
"php-mock/php-mock-phpunit": "~1.1||~2.0"
},
"autoload": {
"psr-0": {
Expand All @@ -33,16 +30,37 @@
"scripts": {
"ci": [
"@cs-check",
"@phpstan",
"@test"
"@test",
"@coverage-clover"
],
"cs-check": "php -d memory_limit=-1 ./vendor/bin/phpcs --standard=psr2 ./src ./tests",
"test-5.5": "@test-5",
"test-5.6": "@test-5",
"test-7.0": "@test-7",
"test-7.1": "@test-7",
"test-7.2": "@test-7",
"test-7.4": "@test-7",
"test-8.0": "@test-8",
"test-8.1": "@test-8",
"test-8.2": "@test-8",
"coverage-5.5": "@coverage-5",
"coverage-5.6": "@coverage-5",
"coverage-7.0": "@coverage-7",
"coverage-7.1": "@coverage-7",
"coverage-7.2": "@coverage-7",
"coverage-7.4": "@coverage-7",
"coverage-8.0": "@coverage-8",
"coverage-8.1": "@coverage-8",
"coverage-8.2": "@coverage-8",
"cs-check": "php -d memory_limit=-1 ./vendor/bin/phpcs --standard=psr2 --exclude=Generic.Files.LineLength ./src ./tests",
"cs-checkstyle": "php -d memory_limit=-1 ./vendor/bin/phpcs --standard=psr2 --report=checkstyle ./src ./tests",
"cs-fix": "php -d memory_limit=-1 ./vendor/bin/phpcbf --standard=psr2 ./src ./tests",
"phpstan": "php -d memory_limit=-1 ./vendor/bin/phpstan --no-progress -vvv",
"phpstan-github": "php -d memory_limit=-1 ./vendor/bin/phpstan --no-progress -vvv --error-format=github",
"test": "php -d memory_limit=-1 ./vendor/bin/phpunit --coverage-text --coverage-clover build/logs/clover.xml",
"coverage-clover": "php -d memory_limit=-1 -d xdebug.mode=coverage ./vendor/bin/phpunit --coverage-clover=tmp/coverage.xml --testdox",
"test": "@test-8",
"test-5": "php -d memory_limit=-1 ./vendor/bin/phpunit -c phpunit.5.xml --colors=always --log-junit unitreport.xml --testdox",
"test-7": "php -d memory_limit=-1 ./vendor/bin/phpunit -c phpunit.7.xml --colors=always --log-junit unitreport.xml --testdox",
"test-8": "php -d memory_limit=-1 ./vendor/bin/phpunit -c phpunit.8.xml --colors=always --log-junit unitreport.xml --testdox",
"coverage-5": "php -d memory_limit=-1 -d xdebug.mode=coverage ./vendor/bin/phpunit -c phpunit.5.xml --coverage-text --coverage-clover=./tmp/coverage.xml --testdox",
"coverage-7": "php -d memory_limit=-1 -d xdebug.mode=coverage ./vendor/bin/phpunit -c phpunit.7.xml --coverage-text --coverage-clover=./tmp/coverage.xml --testdox",
"coverage-8": "php -d memory_limit=-1 -d xdebug.mode=coverage ./vendor/bin/phpunit -c phpunit.8.xml --coverage-text --coverage-clover=./tmp/coverage.xml --testdox",
"coveralls": "php -d memory_limit=-1 ./vendor/bin/vendor/bin/coveralls -v"
}
}
9 changes: 0 additions & 9 deletions phpstan.neon

This file was deleted.

30 changes: 30 additions & 0 deletions phpunit.5.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
bootstrap="./tests/bootstrap.php"
>
<testsuites>
<testsuite name="Dotenv Test Suite">
<directory suffix=".php">tests/josegonzalez/Dotenv</directory>
</testsuite>
</testsuites>
<filter>
<blacklist>
<directory suffix=".php">./docs</directory>
<directory suffix=".php">./vendor</directory>
<file>./tests/bootstrap.php</file>
</blacklist>
<!-- this is required, even if empty, until
https://github.com/sebastianbergmann/phpunit/issues/1872
is resolved -->
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">src</directory>
</whitelist>
</filter>
</phpunit>
8 changes: 8 additions & 0 deletions phpunit.xml → phpunit.7.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,12 @@
<directory suffix=".php">tests/josegonzalez/Dotenv</directory>
</testsuite>
</testsuites>
<filter>
<!-- this is required, even if empty, until
https://github.com/sebastianbergmann/phpunit/issues/1872
is resolved -->
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">src</directory>
</whitelist>
</filter>
</phpunit>
13 changes: 13 additions & 0 deletions phpunit.8.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd" bootstrap="tests/bootstrap.php" executionOrder="depends,defects" forceCoversAnnotation="true" beStrictAboutCoversAnnotation="true" beStrictAboutOutputDuringTests="true" beStrictAboutTodoAnnotatedTests="true" convertDeprecationsToExceptions="true" failOnRisky="false" failOnWarning="true" backupGlobals="false" backupStaticAttributes="false" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" verbose="true">
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">./src</directory>
</include>
</coverage>
<testsuites>
<testsuite name="Dotenv Test Suite">
<directory suffix=".php">tests/josegonzalez/Dotenv</directory>
</testsuite>
</testsuites>
</phpunit>
32 changes: 32 additions & 0 deletions phpunit.8.xml.bak
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.6/phpunit.xsd"
bootstrap="tests/bootstrap.php"
executionOrder="depends,defects"
forceCoversAnnotation="true"
beStrictAboutCoversAnnotation="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutTodoAnnotatedTests="true"
convertDeprecationsToExceptions="true"
failOnRisky="false"
failOnWarning="true"
backupGlobals="false"
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
verbose="true">
<testsuites>
<testsuite name="Dotenv Test Suite">
<directory suffix=".php">tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./src</directory>
</whitelist>
</filter>
</phpunit>
Loading