Skip to content

Commit b1bdef5

Browse files
committed
Make dev testing a little easier.
1 parent e90b5ed commit b1bdef5

5 files changed

Lines changed: 18 additions & 3 deletions

File tree

.env.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Steam API key for testing
2+
apiKey=

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@
22
composer.phar
33
.DS_Store
44
ocular.phar
5-
uploadTests.sh
5+
uploadTests.sh
6+
.env
7+
.phpunit.*

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
},
1717
"require-dev": {
1818
"phpunit/phpunit": "^8.0",
19-
"orchestra/testbench": "^3.0"
19+
"orchestra/testbench": "^3.0",
20+
"vlucas/phpdotenv": "^3.6"
2021
},
2122
"autoload": {
2223
"psr-4": {

composer.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/BaseTester.php

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

33
use Orchestra\Testbench\TestCase;
44
use Syntax\SteamApi\Client;
5+
use Dotenv\Dotenv;
56

67
class BaseTester extends TestCase {
78

@@ -28,6 +29,15 @@ class BaseTester extends TestCase {
2829
protected function setUp(): void
2930
{
3031
parent::setUp();
32+
33+
$root = dirname(__DIR__, 1);
34+
35+
// Use .env when available
36+
if (file_exists($root . '/.env')) {
37+
$dotenv = Dotenv::create($root);
38+
$dotenv->load();
39+
}
40+
3141
$this->steamClient = new Client();
3242
}
3343

0 commit comments

Comments
 (0)