@@ 40-49 (lines=10) @@ | ||
37 | } |
|
38 | ||
39 | /** @test */ |
|
40 | public function it_can_be_user_multiple_times_if_it_is_not_disposable() |
|
41 | { |
|
42 | $promocodes = Promocodes::create(); |
|
43 | $promocode = $promocodes->first(); |
|
44 | ||
45 | $this->assertCount(1, $promocodes); |
|
46 | ||
47 | $this->user->applyCode($promocode['code']); |
|
48 | $this->user->applyCode($promocode['code']); |
|
49 | } |
|
50 | ||
51 | /** @test */ |
|
52 | public function it_returns_false_for_second_use_of_disposable_code() |
|
@@ 96-106 (lines=11) @@ | ||
93 | } |
|
94 | ||
95 | /** @test */ |
|
96 | public function it_returns_promocode_with_user_in_callback_if_applied_successfuly() |
|
97 | { |
|
98 | $promocodes = Promocodes::create(); |
|
99 | $promocode = $promocodes->first(); |
|
100 | ||
101 | $this->assertCount(1, $promocodes); |
|
102 | ||
103 | $this->user->applyCode($promocode['code'], function ($appliedPromocode) { |
|
104 | $this->assertTrue($appliedPromocode instanceof Promocode); |
|
105 | }); |
|
106 | } |
|
107 | ||
108 | /** @test */ |
|
109 | public function it_has_alias_named_reedem_code() |
|
@@ 109-119 (lines=11) @@ | ||
106 | } |
|
107 | ||
108 | /** @test */ |
|
109 | public function it_has_alias_named_reedem_code() |
|
110 | { |
|
111 | $promocodes = Promocodes::create(); |
|
112 | $promocode = $promocodes->first(); |
|
113 | ||
114 | $this->assertCount(1, $promocodes); |
|
115 | ||
116 | $this->user->redeemCode($promocode['code']); |
|
117 | ||
118 | $this->assertCount(1, $this->user->promocodes); |
|
119 | } |
|
120 | } |
|
121 |