|
16 | 16 | $table->timestamps(); |
17 | 17 | }); |
18 | 18 |
|
19 | | - |
20 | 19 | $mockPolicyFunction = function ($permission): bool { |
21 | 20 | if ($permission == 'todo_perm' || $permission == 'in_progress_perm') { |
22 | 21 | return true; |
23 | 22 | } |
| 23 | + |
24 | 24 | return false; |
25 | 25 | }; |
26 | 26 |
|
27 | 27 | Config::set('aissue.policyMethod', $mockPolicyFunction); |
28 | | - |
29 | 28 | }); |
30 | 29 |
|
31 | 30 | test('can read aissue config', function () { |
|
36 | 35 | $this->assertTrue(config('aissue')['policyMethod'] instanceof \Closure); |
37 | 36 | }); |
38 | 37 |
|
39 | | -test('can access policy method works', function () { |
40 | | - $this->assertTrue(config('aissue')['policyMethod']('test permission')); |
| 38 | +test('can access policy method works for todo', function () { |
| 39 | + $this->assertTrue(config('aissue')['policyMethod']('todo_perm')); |
41 | 40 | }); |
42 | 41 |
|
43 | 42 | test('can get one specified issue', function () { |
|
59 | 58 | ); |
60 | 59 | }); |
61 | 60 |
|
62 | | - |
63 | 61 | test('can check make transition for todo', function () { |
64 | | - |
65 | 62 | $createdModel = Issueable::create( |
66 | 63 | ['name' => 'test isuable model 2'] |
67 | 64 | ); |
|
73 | 70 | }); |
74 | 71 |
|
75 | 72 | test('can check make transition for in_progress', function () { |
76 | | - |
77 | 73 | $createdModel = Issueable::create( |
78 | 74 | ['name' => 'test isuable model 3'] |
79 | 75 | ); |
|
85 | 81 | }); |
86 | 82 |
|
87 | 83 | test('can check make transition for done', function () { |
88 | | - |
89 | 84 | $createdModel = Issueable::create( |
90 | 85 | ['name' => 'test isuable model 4'] |
91 | 86 | ); |
|
95 | 90 |
|
96 | 91 | $this->assertFalse($createdIssueModel->canMakeTransition('done')); |
97 | 92 | }); |
98 | | - |
99 | | -test('can make transition', function () { |
100 | | - |
101 | | - $createdModel = Issueable::create( |
102 | | - ['name' => 'test isuable model 1'] |
103 | | - ); |
104 | | - |
105 | | - $createdIssueModel = $createdModel->createIssue(1, 1, 'task', 'test isssue 1', 'asdasd', 1, \Illuminate\Support\Carbon::now()); |
106 | | - |
107 | | - $createdAissue = $this->aissue->createIssue($this->data); |
108 | | - $transition = $this->aissue->makeTransition($createdAissue, 'todo'); |
109 | | - $this->assertTrue($transition->status == 'todo'); |
110 | | -}); |
111 | | - |
112 | | -test('can get transitionable statuses', function () { |
113 | | - $createdAissue = $this->aissue->createIssue($this->data); |
114 | | - $transitionableStatuses = $this->aissue->getTransitionableStatuses($createdAissue); |
115 | | - // $this->assertTrue($transition->status == 'todo'); |
116 | | -}); |
117 | | - |
118 | | -test('x', function () { |
119 | | -}); |
0 commit comments