This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Gabievi\Promocodes\Tests; |
||
4 | |||
5 | use Promocodes; |
||
6 | |||
7 | class CreatePromocodesToDatabaseTest extends TestCase |
||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
8 | { |
||
9 | /** @test */ |
||
10 | View Code Duplication | public function it_will_create_only_one_code_without_parameters() |
|
11 | { |
||
12 | $promocodes = Promocodes::create(); |
||
13 | $promocode = $promocodes->first(); |
||
14 | |||
15 | $this->assertCount(1, $promocodes); |
||
16 | $this->assertDatabaseHas('promocodes', [ |
||
0 ignored issues
–
show
The method
assertDatabaseHas() does not seem to exist on object<Gabievi\Promocode...omocodesToDatabaseTest> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. ![]() |
|||
17 | 'code' => $promocode['code'] |
||
18 | ]); |
||
19 | } |
||
20 | |||
21 | /** @test */ |
||
22 | View Code Duplication | public function it_can_create_several_promocodes_and_save_in_database() |
|
23 | { |
||
24 | $promocodes = Promocodes::create(10); |
||
25 | $firstPromocode = $promocodes->first(); |
||
26 | $lastPromocode = $promocodes->last(); |
||
27 | |||
28 | $this->assertCount(10, $promocodes); |
||
29 | $this->assertDatabaseHas('promocodes', [ |
||
0 ignored issues
–
show
The method
assertDatabaseHas() does not seem to exist on object<Gabievi\Promocode...omocodesToDatabaseTest> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. ![]() |
|||
30 | 'code' => $firstPromocode['code'] |
||
31 | ]); |
||
32 | $this->assertDatabaseHas('promocodes', [ |
||
0 ignored issues
–
show
The method
assertDatabaseHas() does not seem to exist on object<Gabievi\Promocode...omocodesToDatabaseTest> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. ![]() |
|||
33 | 'code' => $lastPromocode['code'] |
||
34 | ]); |
||
35 | } |
||
36 | |||
37 | /** @test */ |
||
38 | View Code Duplication | public function it_can_set_reward_value_to_promocodes() |
|
39 | { |
||
40 | $promocodes = Promocodes::create(1, 10); |
||
41 | $promocode = $promocodes->first(); |
||
42 | |||
43 | $this->assertCount(1, $promocodes); |
||
44 | $this->assertSame(10, $promocode['reward']); |
||
45 | $this->assertDatabaseHas('promocodes', [ |
||
0 ignored issues
–
show
The method
assertDatabaseHas() does not seem to exist on object<Gabievi\Promocode...omocodesToDatabaseTest> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. ![]() |
|||
46 | 'code' => $promocode['code'], |
||
47 | 'reward' => $promocode['reward'] |
||
48 | ]); |
||
49 | } |
||
50 | |||
51 | /** @test */ |
||
52 | public function it_can_set_additional_data_to_promocodes() |
||
53 | { |
||
54 | $data = [ |
||
55 | 'foo' => 'bar', |
||
56 | 'baz' => 'qux', |
||
57 | ]; |
||
58 | |||
59 | $promocodes = Promocodes::create(1, null, $data); |
||
60 | $promocode = $promocodes->first(); |
||
61 | |||
62 | $this->assertCount(1, $promocodes); |
||
63 | $this->assertDatabaseHas('promocodes', [ |
||
0 ignored issues
–
show
The method
assertDatabaseHas() does not seem to exist on object<Gabievi\Promocode...omocodesToDatabaseTest> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. ![]() |
|||
64 | 'code' => $promocode['code'], |
||
65 | 'data' => json_encode($data), |
||
66 | ]); |
||
67 | $this->assertSame('bar', $promocode['data']['foo']); |
||
68 | } |
||
69 | |||
70 | /** @test */ |
||
71 | public function it_can_set_days_to_expire_promocode() |
||
72 | { |
||
73 | $promocodes = Promocodes::create(1, null, [], 5); |
||
74 | $promocode = $promocodes->first(); |
||
75 | |||
76 | $expires_at = date('Y-m-d H:i:s', strtotime('+5 days')); |
||
77 | |||
78 | $this->assertCount(1, $promocodes); |
||
79 | $this->assertDatabaseHas('promocodes', [ |
||
0 ignored issues
–
show
The method
assertDatabaseHas() does not seem to exist on object<Gabievi\Promocode...omocodesToDatabaseTest> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. ![]() |
|||
80 | 'code' => $promocode['code'], |
||
81 | 'expires_at' => $expires_at, |
||
82 | ]); |
||
83 | } |
||
84 | |||
85 | /** @test */ |
||
86 | View Code Duplication | public function it_will_create_multiuse_promocode_by_deafult() |
|
87 | { |
||
88 | $promocodes = Promocodes::create(); |
||
89 | $promocode = $promocodes->first(); |
||
90 | |||
91 | $this->assertCount(1, $promocodes); |
||
92 | $this->assertDatabaseHas('promocodes', [ |
||
0 ignored issues
–
show
The method
assertDatabaseHas() does not seem to exist on object<Gabievi\Promocode...omocodesToDatabaseTest> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. ![]() |
|||
93 | 'code' => $promocode['code'], |
||
94 | 'is_disposable' => false, |
||
95 | ]); |
||
96 | } |
||
97 | |||
98 | /** @test */ |
||
99 | View Code Duplication | public function it_can_create_disposable_promocode() |
|
100 | { |
||
101 | $promocodes = Promocodes::createDisposable(); |
||
102 | $promocode = $promocodes->first(); |
||
103 | |||
104 | $this->assertCount(1, $promocodes); |
||
105 | $this->assertDatabaseHas('promocodes', [ |
||
0 ignored issues
–
show
The method
assertDatabaseHas() does not seem to exist on object<Gabievi\Promocode...omocodesToDatabaseTest> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. ![]() |
|||
106 | 'code' => $promocode['code'], |
||
107 | 'is_disposable' => true, |
||
108 | ]); |
||
109 | } |
||
110 | |||
111 | /** @test */ |
||
112 | public function it_can_output_all_valid_promocodes() |
||
113 | { |
||
114 | $promocodes = Promocodes::create(5); |
||
115 | $promocode = $promocodes->first(); |
||
116 | |||
117 | $this->assertCount(5, Promocodes::all()); |
||
118 | |||
119 | Promocodes::disable($promocode['code']); |
||
120 | |||
121 | $this->assertCount(4, Promocodes::all()); |
||
122 | } |
||
123 | } |
||
124 |