Skip to content

Commit 8884da9

Browse files
committed
Add attributes to the phar test
1 parent 199efd9 commit 8884da9

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

tests/phar/phpunit.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@
1111
</testsuites>
1212

1313
<extensions>
14-
<bootstrap class="Zalas\PHPUnit\Globals\AnnotationExtension" />
14+
<bootstrap class="Zalas\PHPUnit\Globals\Tests\Stub\CombinedExtension" />
1515
</extensions>
1616
</phpunit>

tests/phar/tests/PharTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
declare(strict_types=1);
33

44
use PHPUnit\Framework\TestCase;
5+
use Zalas\PHPUnit\Globals\Attribute\Env;
6+
use Zalas\PHPUnit\Globals\Attribute\Server;
57

68
class PharTest extends TestCase
79
{
@@ -15,6 +17,14 @@ public function test_it_reads_global_variables_from_method_annotations()
1517
$this->assertArraySubset(['APP_DEBUG' => '1'], $_SERVER);
1618
}
1719

20+
#[Env("APP_ENV", "test_foo")]
21+
#[Server("APP_DEBUG", "1")]
22+
public function test_it_reads_global_variables_from_method_attributes()
23+
{
24+
$this->assertArraySubset(['APP_ENV' => 'test_foo'], $_ENV);
25+
$this->assertArraySubset(['APP_DEBUG' => '1'], $_SERVER);
26+
}
27+
1828
/**
1929
* Provides a replacement for the assertion deprecated in PHPUnit 8 and removed in PHPUnit 9.
2030
* @param array $subset

0 commit comments

Comments
 (0)