Skip to content

Commit f9ee62d

Browse files
TatevikGrtatevikg1
andauthored
Refactor: env (#170)
* Update .gitignore and composer.json for environment configuration * fix test * use dev --------- Co-authored-by: Tatevik <tatevikg1@gmail.com>
1 parent 8ba12b3 commit f9ee62d

7 files changed

Lines changed: 20 additions & 6 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ jobs:
7373
export PHPLIST_DATABASE_PASSWORD=${{ env.DB_PASSWORD }}
7474
export PHPLIST_DATABASE_PORT=${{ job.services.mysql.ports['3306'] }}
7575
export PHPLIST_DATABASE_HOST=127.0.0.1
76+
export PHPLIST_DATABASE_PATH=
7677
vendor/bin/phpunit tests/Integration/
7778
continue-on-error: ${{matrix.php-versions == '8.0' }} # [temp-php8]
7879
- name: Running static analysis

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,5 @@
1515
/var/
1616
/vendor/
1717
.phpunit.result.cache
18+
.env
19+
.env.dist

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
},
4343
"require": {
4444
"php": "^8.1",
45-
"phplist/core": "dev-main",
45+
"phplist/core": "dev-dev",
4646
"friendsofsymfony/rest-bundle": "*",
4747
"symfony/test-pack": "^1.0",
4848
"symfony/process": "^6.4",
@@ -85,6 +85,7 @@
8585
"PhpList\\Core\\Composer\\ScriptHandler::createGeneralConfiguration",
8686
"PhpList\\Core\\Composer\\ScriptHandler::createBundleConfiguration",
8787
"PhpList\\Core\\Composer\\ScriptHandler::createRoutesConfiguration",
88+
"PhpList\\Core\\Composer\\ScriptHandler::createDotenvConfiguration",
8889
"PhpList\\Core\\Composer\\ScriptHandler::createParametersConfiguration",
8990
"PhpList\\Core\\Composer\\ScriptHandler::clearAllCaches"
9091
],

phpunit.xml.dist

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@
55
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/6.2/phpunit.xsd"
66
backupGlobals="false"
77
colors="true"
8-
bootstrap="vendor/autoload.php"
8+
bootstrap="tests/bootstrap.php"
99
>
1010
<php>
1111
<ini name="error_reporting" value="-1"/>
1212
<server name="KERNEL_CLASS" value="PhpList\Core\Core\ApplicationKernel"/>
13+
<server name="APP_ENV" value="test" force="true"/>
1314
</php>
1415
</phpunit>

tests/Integration/Common/Routing/RoutingTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class RoutingTest extends WebTestCase
1616
public function testRootUrlHasHtmlContentType()
1717
{
1818
$client = self::createClient();
19-
$client->request('get', '/api/v2');
19+
$client->request('GET', '/api/v2', server: ['HTTP_ACCEPT' => 'text/html']);
2020

2121
$response = $client->getResponse();
2222

tests/Integration/Composer/ScriptsTest.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,7 @@ private function getAbsolutePublicDirectoryPath(): string
2929
public static function publicDirectoryFilesDataProvider(): array
3030
{
3131
return [
32-
'production entry point' => ['app.php'],
33-
'development entry point' => ['app_dev.php'],
34-
'testing entry point' => ['app_test.php'],
32+
'entry point' => ['index.php'],
3533
'.htaccess' => ['.htaccess'],
3634
];
3735
}

tests/bootstrap.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use Symfony\Component\Dotenv\Dotenv;
6+
7+
require dirname(__DIR__) . '/vendor/autoload.php';
8+
9+
if (method_exists(Dotenv::class, 'bootEnv')) {
10+
(new Dotenv())->bootEnv(dirname(__DIR__) . '/.env');
11+
}

0 commit comments

Comments
 (0)