Skip to content

Commit e97dbd3

Browse files
authored
Merge pull request #55 from 302dev/pr-55
Pull request replaces #54
2 parents f6d2fb6 + 01db3ac commit e97dbd3

File tree

13 files changed

+771
-43
lines changed

13 files changed

+771
-43
lines changed

.github/workflows/ci.yml

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- '*'
7+
push:
8+
branches:
9+
- '*'
10+
11+
permissions:
12+
contents: read
13+
14+
jobs:
15+
coding-standard:
16+
runs-on: ubuntu-22.04
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
php-version: ['5.5', '5.6', '7.1', '7.2', '7.4', '8.0', '8.1', '8.2']
21+
name: Coding Standard ${{ matrix.php-version }}
22+
23+
steps:
24+
- uses: actions/checkout@v3
25+
26+
- name: Setup PHP
27+
uses: shivammathur/setup-php@v2
28+
with:
29+
php-version: ${{ matrix.php-version }}
30+
extensions: mbstring, intl
31+
coverage: none
32+
33+
- name: Composer install
34+
run: composer install
35+
36+
- name: Run PHP CodeSniffer
37+
run: composer run-script cs-check
38+
39+
test:
40+
runs-on: ubuntu-22.04
41+
strategy:
42+
fail-fast: false
43+
matrix:
44+
php-version: ['5.5', '5.6', '7.1', '7.2', '7.4', '8.0', '8.1', '8.2']
45+
name: Test PHP ${{ matrix.php-version }}
46+
47+
steps:
48+
- uses: actions/checkout@v3
49+
50+
- name: Setup PHP
51+
uses: shivammathur/setup-php@v2
52+
with:
53+
php-version: ${{ matrix.php-version }}
54+
extensions: mbstring, intl
55+
coverage: none
56+
57+
- name: Composer install
58+
run: composer install
59+
60+
- name: Run PHPUnit
61+
run: composer run-script test-${{ matrix.php-version }}
62+
63+
coverage-php:
64+
runs-on: ubuntu-22.04
65+
strategy:
66+
fail-fast: false
67+
matrix:
68+
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.
69+
name: Coverage PHP ${{ matrix.php-version }}
70+
71+
steps:
72+
- uses: actions/checkout@v3
73+
74+
- name: Setup PHP
75+
uses: shivammathur/setup-php@v2
76+
with:
77+
php-version: ${{ matrix.php-version }}
78+
extensions: mbstring, intl
79+
coverage: pcov
80+
81+
- name: Composer install
82+
run: composer install
83+
84+
- name: Run PHPUnit
85+
run: composer run-script coverage-${{ matrix.php-version }}
86+
87+
- name: Upload to Codecov
88+
uses: codecov/codecov-action@v3
89+
with:
90+
token: ${{ secrets.CODECOV_TOKEN }}
91+
files: ./tmp/coverage.xml
92+
verbose: true

.gitignore

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
.DS_Store
22
build
33
composer.lock
4-
tmp
4+
tmp/*
5+
!tmp/.gitkeep
56
vendor
7+
.phpunit.result.cache
8+
/.phpunit.cache
9+
coverage.xml
10+
unitreport.xml
11+
.vscode

.travis.yml

Lines changed: 0 additions & 23 deletions
This file was deleted.

README.markdown

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[![Build Status](https://img.shields.io/travis/josegonzalez/php-dotenv/master.svg?branch=master&style=flat-square)](https://travis-ci.org/josegonzalez/php-dotenv)
2-
[![Coverage Status](https://img.shields.io/coveralls/josegonzalez/php-dotenv.svg?branch=master&style=flat-square)](https://coveralls.io/r/josegonzalez/php-dotenv?branch=master)
2+
[![Coverage Status](https://img.shields.io/codecov/c/github/josegonzalez/dotenv.svg?style=flat-square)](https://codecov.io/github/josegonzalez/dotenv)
33
[![Total Downloads](https://img.shields.io/packagist/dt/josegonzalez/dotenv.svg?style=flat-square)](https://packagist.org/packages/josegonzalez/dotenv)
44
[![Latest Stable Version](https://img.shields.io/packagist/v/josegonzalez/dotenv.svg?style=flat-square)](https://packagist.org/packages/josegonzalez/dotenv)
55

@@ -19,14 +19,14 @@ A `.env` file parsing and loading library for PHP.
1919

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

22-
Run `composer require josegonzalez/dotenv:dev-master`
22+
Run `composer require josegonzalez/dotenv:`
2323

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

2626
```javascript
2727
{
2828
"require": {
29-
"josegonzalez/dotenv": "dev-master"
29+
"josegonzalez/dotenv": "3.3.0"
3030
}
3131
}
3232
```

composer.json

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,49 @@
1818
"m1/env": "2.*"
1919
},
2020
"require-dev": {
21-
"squizlabs/php_codesniffer": "2.*",
22-
"satooshi/php-coveralls": "1.*",
23-
"php-mock/php-mock-phpunit": "^1.1"
21+
"squizlabs/php_codesniffer": "~2.9||~3.7",
22+
"php-coveralls/php-coveralls": "~2.0",
23+
"php-mock/php-mock-phpunit": "~1.1||~2.0"
2424
},
2525
"autoload": {
2626
"psr-0": {
2727
"josegonzalez\\Dotenv": ["src", "tests"]
2828
}
29+
},
30+
"scripts": {
31+
"ci": [
32+
"@cs-check",
33+
"@test",
34+
"@coverage-clover"
35+
],
36+
"test-5.5": "@test-5",
37+
"test-5.6": "@test-5",
38+
"test-7.0": "@test-7",
39+
"test-7.1": "@test-7",
40+
"test-7.2": "@test-7",
41+
"test-7.4": "@test-7",
42+
"test-8.0": "@test-8",
43+
"test-8.1": "@test-8",
44+
"test-8.2": "@test-8",
45+
"coverage-5.5": "@coverage-5",
46+
"coverage-5.6": "@coverage-5",
47+
"coverage-7.0": "@coverage-7",
48+
"coverage-7.1": "@coverage-7",
49+
"coverage-7.2": "@coverage-7",
50+
"coverage-7.4": "@coverage-7",
51+
"coverage-8.0": "@coverage-8",
52+
"coverage-8.1": "@coverage-8",
53+
"coverage-8.2": "@coverage-8",
54+
"cs-check": "php -d memory_limit=-1 ./vendor/bin/phpcs --standard=psr2 --exclude=Generic.Files.LineLength ./src ./tests",
55+
"cs-checkstyle": "php -d memory_limit=-1 ./vendor/bin/phpcs --standard=psr2 --report=checkstyle ./src ./tests",
56+
"cs-fix": "php -d memory_limit=-1 ./vendor/bin/phpcbf --standard=psr2 ./src ./tests",
57+
"test": "@test-8",
58+
"test-5": "php -d memory_limit=-1 ./vendor/bin/phpunit -c phpunit.5.xml --colors=always --log-junit unitreport.xml --testdox",
59+
"test-7": "php -d memory_limit=-1 ./vendor/bin/phpunit -c phpunit.7.xml --colors=always --log-junit unitreport.xml --testdox",
60+
"test-8": "php -d memory_limit=-1 ./vendor/bin/phpunit -c phpunit.8.xml --colors=always --log-junit unitreport.xml --testdox",
61+
"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",
62+
"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",
63+
"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",
64+
"coveralls": "php -d memory_limit=-1 ./vendor/bin/vendor/bin/coveralls -v"
2965
}
3066
}

phpunit.xml renamed to phpunit.5.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
convertWarningsToExceptions="true"
88
processIsolation="false"
99
stopOnFailure="false"
10-
syntaxCheck="false"
1110
bootstrap="./tests/bootstrap.php"
1211
>
1312
<testsuites>

phpunit.7.xml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<phpunit backupGlobals="false"
3+
backupStaticAttributes="false"
4+
colors="true"
5+
convertErrorsToExceptions="true"
6+
convertNoticesToExceptions="true"
7+
convertWarningsToExceptions="true"
8+
processIsolation="false"
9+
stopOnFailure="false"
10+
bootstrap="./tests/bootstrap.php"
11+
>
12+
<testsuites>
13+
<testsuite name="Dotenv Test Suite">
14+
<directory suffix=".php">tests/josegonzalez/Dotenv</directory>
15+
</testsuite>
16+
</testsuites>
17+
<filter>
18+
<!-- this is required, even if empty, until
19+
https://github.com/sebastianbergmann/phpunit/issues/1872
20+
is resolved -->
21+
<whitelist processUncoveredFilesFromWhitelist="true">
22+
<directory suffix=".php">src</directory>
23+
</whitelist>
24+
</filter>
25+
</phpunit>

phpunit.8.xml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<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">
3+
<coverage processUncoveredFiles="true">
4+
<include>
5+
<directory suffix=".php">./src</directory>
6+
</include>
7+
</coverage>
8+
<testsuites>
9+
<testsuite name="Dotenv Test Suite">
10+
<directory suffix=".php">tests/josegonzalez/Dotenv</directory>
11+
</testsuite>
12+
</testsuites>
13+
</phpunit>

src/josegonzalez/Dotenv/Expect.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
class Expect
99
{
10+
protected $environment = array();
11+
1012
protected $raise = true;
1113

1214
public function __construct($environment, $raise = true)

src/josegonzalez/Dotenv/Loader.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ class Loader
1313

1414
protected $environment = null;
1515

16+
protected $exceptions = array();
17+
1618
protected $filepaths = null;
1719

1820
protected $filters = array();
@@ -32,7 +34,6 @@ class Loader
3234
public function __construct($filepaths = null)
3335
{
3436
$this->setFilepaths($filepaths);
35-
return $this;
3637
}
3738

3839
public static function load($options = null)

0 commit comments

Comments
 (0)