|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare( strict_types = 1 ); |
|
4
|
|
|
|
|
5
|
|
|
namespace WMDE\Fundraising\Store\Tests; |
|
6
|
|
|
|
|
7
|
|
|
use WMDE\Fundraising\Entities\Subscription; |
|
8
|
|
|
|
|
9
|
|
|
/** |
|
10
|
|
|
* @covers WMDE\Fundraising\Entities\Subscription |
|
11
|
|
|
* |
|
12
|
|
|
* @licence GNU GPL v2+ |
|
13
|
|
|
* @author Gabriel Birke < [email protected] > |
|
14
|
|
|
* @author Jeroen De Dauw < [email protected] > |
|
15
|
|
|
*/ |
|
16
|
|
|
class SubscriptionTest extends \PHPUnit_Framework_TestCase { |
|
17
|
|
|
|
|
18
|
|
|
public function testSetAndGetSource() { |
|
19
|
|
|
$subscription = new Subscription(); |
|
20
|
|
|
$subscription->setSource( 'foobar' ); |
|
21
|
|
|
$this->assertSame( 'foobar', $subscription->getSource() ); |
|
22
|
|
|
} |
|
23
|
|
|
|
|
24
|
|
|
public function testWhenSubscriptionIsNew_isUnconfirmedReturnsTrue() { |
|
25
|
|
|
$this->assertTrue( ( new Subscription() )->isUnconfirmed() ); |
|
26
|
|
|
} |
|
27
|
|
|
|
|
28
|
|
|
public function testWhenConfirmed_isUnconfirmedReturnsFalse() { |
|
29
|
|
|
$subscription = new Subscription(); |
|
30
|
|
|
$subscription->markAsConfirmed(); |
|
31
|
|
|
|
|
32
|
|
|
$this->assertFalse( $subscription->isUnconfirmed() ); |
|
33
|
|
|
} |
|
34
|
|
|
|
|
35
|
|
|
public function testWhenPendingModeration_isUnconfirmedReturnsTrue() { |
|
36
|
|
|
$subscription = new Subscription(); |
|
37
|
|
|
$subscription->markForModeration(); |
|
38
|
|
|
|
|
39
|
|
|
$this->assertTrue( $subscription->isUnconfirmed() ); |
|
40
|
|
|
} |
|
41
|
|
|
|
|
42
|
|
|
public function testWhenSubscriptionIsNew_needsModerationReturnsFalse() { |
|
43
|
|
|
$subscription = new Subscription(); |
|
44
|
|
|
|
|
45
|
|
|
$this->assertFalse( $subscription->needsModeration() ); |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
|
|
public function testWhenPendingModeration_needsModerationReturnsTrue() { |
|
49
|
|
|
$subscription = new Subscription(); |
|
50
|
|
|
$subscription->markForModeration(); |
|
51
|
|
|
|
|
52
|
|
|
$this->assertTrue( $subscription->needsModeration() ); |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
|
|
} |
|
56
|
|
|
|