File tree Expand file tree Collapse file tree 2 files changed +58
-0
lines changed Expand file tree Collapse file tree 2 files changed +58
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace Tests \Acceptance ;
4
+
5
+ use Coding \Core ;
6
+ use Coding \Issue ;
7
+
8
+ class IssueTest extends TestCase
9
+ {
10
+ public function testCreateAndDelete ()
11
+ {
12
+ $ data = [
13
+ 'ProjectName ' => $ this ->projectName ,
14
+ 'Name ' => $ this ->faker ->sentence ,
15
+ 'Priority ' => $ this ->faker ->randomElement (Issue::PRIORITY ),
16
+ 'Type ' => $ this ->faker ->randomElement (Issue::TYPE ),
17
+ ];
18
+
19
+ $ issue = new Issue ($ this ->token );
20
+ $ result = $ issue ->create ($ data );
21
+ $ this ->assertTrue (is_numeric ($ result ['Code ' ]));
22
+
23
+ // delete
24
+ $ data = [
25
+ 'ProjectName ' => $ this ->projectName ,
26
+ 'IssueCode ' => $ result ['Code ' ],
27
+ ];
28
+ $ this ->assertTrue ($ issue ->delete ($ data ));
29
+ }
30
+ }
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace Tests \Acceptance ;
4
+
5
+ use Coding \Core ;
6
+ use InvalidArgumentException ;
7
+ use Faker \Factory ;
8
+ use Faker \Generator ;
9
+ use Mockery \Mock ;
10
+ use PHPUnit \Framework \TestCase as PhpUnitTestBase ;
11
+
12
+ class TestCase extends PhpUnitTestBase
13
+ {
14
+ protected Generator $ faker ;
15
+ protected string $ token ;
16
+ protected string $ projectName ;
17
+
18
+ protected function setUp (): void
19
+ {
20
+ parent ::setUp ();
21
+ $ this ->faker = Factory::create ();
22
+ $ this ->token = getenv ('CODING_TOKEN ' );
23
+ $ this ->projectName = getenv ('CODING_PROJECT_NAME ' );
24
+ if (empty ($ this ->token ) || empty ($ this ->projectName )) {
25
+ throw new InvalidArgumentException ('Please set CODING_TOKEN and CODING_PROJECT_NAME environment variables ' );
26
+ }
27
+ }
28
+ }
You can’t perform that action at this time.
0 commit comments