-
-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[8.x] Inherits Attributes defined on parent TestCase (#233)
* See parent class attributes * Update InheritanceTest.php * wip Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com> * wip Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com> * wip Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com> --------- Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com> Co-authored-by: Mior Muhammad Zaki <crynobone@gmail.com>
- Loading branch information
1 parent
57cc64e
commit f8bce62
Showing
3 changed files
with
54 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
namespace Orchestra\Testbench\Tests\Attributes; | ||
|
||
use Orchestra\Testbench\Attributes\WithConfig; | ||
use Orchestra\Testbench\TestCase; | ||
|
||
#[WithConfig('fake.parent_attribute', true)] | ||
#[WithConfig('fake.override_attribute', 'parent')] | ||
abstract class AttributesInheritanceTestBaseTestCase extends TestCase | ||
{ | ||
/** | ||
* @beforeClass | ||
*/ | ||
public static function defineTestingFeatures() | ||
{ | ||
static::usesTestingFeature(new WithConfig('fake.override_attribute_2', 'parent')); | ||
} | ||
} | ||
|
||
#[WithConfig('fake.override_attribute', 'child')] | ||
class AttributesInheritanceTest extends AttributesInheritanceTestBaseTestCase | ||
{ | ||
/** | ||
* @beforeClass | ||
*/ | ||
public static function defineChildTestingFeatures() | ||
{ | ||
static::usesTestingFeature(new WithConfig('fake.override_attribute_2', 'child')); | ||
} | ||
|
||
/** @test */ | ||
public function it_can_see_parent_attributes() | ||
{ | ||
$this->assertSame(true, config('fake.parent_attribute')); | ||
} | ||
|
||
/** @test */ | ||
public function it_can_override_parent_attributes() | ||
{ | ||
$this->assertSame('child', config('fake.override_attribute')); | ||
$this->assertSame('child', config('fake.override_attribute_2')); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters