-
Notifications
You must be signed in to change notification settings - Fork 191
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a7a3db0
commit 0d74e44
Showing
3 changed files
with
84 additions
and
1 deletion.
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
57 changes: 57 additions & 0 deletions
57
tests/Unit/Framework/FieldsAPI/ValueObjects/PersistenceScopeTest.php
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,57 @@ | ||
<?php | ||
|
||
namespace Unit\Framework\FieldsAPI\ValueObjects; | ||
|
||
use Give\Framework\FieldsAPI\ValueObjects\PersistenceScope; | ||
use Give\Tests\TestCase; | ||
|
||
/** | ||
* @coversDefaultClass \Give\Framework\FieldsAPI\ValueObjects\PersistenceScope | ||
*/ | ||
class PersistenceScopeTest extends TestCase | ||
{ | ||
/** | ||
* @unreleased | ||
*/ | ||
public function testStaticBuilders(): void | ||
{ | ||
$donation = PersistenceScope::donation(); | ||
$donor = PersistenceScope::donor(); | ||
|
||
self::assertInstanceOf(PersistenceScope::class, $donation); | ||
self::assertTrue($donation->isDonation()); | ||
|
||
self::assertInstanceOf(PersistenceScope::class, $donor); | ||
self::assertTrue($donor->isDonor()); | ||
} | ||
|
||
/** | ||
* @unreleased | ||
*/ | ||
public function testToString() | ||
{ | ||
$scope = PersistenceScope::donation(); | ||
self::assertEquals('donation', (string)$scope); | ||
} | ||
|
||
/** | ||
* @unreleased | ||
*/ | ||
public function testIsMethods() | ||
{ | ||
$donation = PersistenceScope::donation(); | ||
|
||
self::assertTrue($donation->isDonation()); | ||
self::assertFalse($donation->isDonor()); | ||
self::assertTrue($donation->is(PersistenceScope::DONATION)); | ||
} | ||
|
||
/** | ||
* @unreleased | ||
*/ | ||
public function testConstructor() | ||
{ | ||
$scope = new PersistenceScope('donation'); | ||
self::assertTrue($scope->isDonation()); | ||
} | ||
} |