@@ -16,59 +16,64 @@ class ProjectTest extends TestCase
1616 * @test
1717 *
1818 */
19- public function get_project_info () : void
19+ public function get_project_lists () : string
2020 {
21+ $ projKey = 'TEST ' ;
2122 try {
2223 $ proj = new ProjectService ();
2324
24- $ p = $ proj ->get ( ' TEST ' );
25+ $ prjs = $ proj ->getAllProjects ( );
2526
26- $ this ->assertTrue ($ p instanceof Project);
27- $ this ->assertTrue (strlen ($ p ->key ) > 0 );
28- $ this ->assertTrue (!empty ($ p ->id ));
29- $ this ->assertTrue (strlen ($ p ->name ) > 0 );
30- // $this->assertTrue(strlen($p->projectCategory['name']) > 0);
27+ foreach ($ prjs as $ p ) {
28+ $ this ->assertTrue ($ p instanceof Project);
29+ $ this ->assertTrue (strlen ($ p ->key ) > 0 );
30+ $ this ->assertTrue (!empty ($ p ->id ));
31+ $ this ->assertTrue (strlen ($ p ->name ) > 0 );
32+ // $this->assertTrue(strlen($p->projectCategory['name']) > 0);
33+
34+ }
3135 } catch (\Exception $ e ) {
32- $ this ->fail ('get_project_info ' . $ e ->getMessage ());
36+ $ this ->fail ('get_project_lists ' . $ e ->getMessage ());
3337 }
34- }
3538
39+ return $ projKey ;
40+ }
3641 /**
3742 * @test
38- * @depends get_project_info
39- *
43+ * @depends get_project_lists
4044 */
41- public function get_project_lists ( ) : void
45+ public function get_project_info ( string $ projKey ) : string
4246 {
4347 try {
4448 $ proj = new ProjectService ();
4549
46- $ prjs = $ proj ->getAllProjects ();
50+ $ p = $ proj ->get ($ projKey );
51+
52+ $ this ->assertTrue ($ p instanceof Project);
53+ $ this ->assertTrue (strlen ($ p ->key ) > 0 );
54+ $ this ->assertTrue (!empty ($ p ->id ));
55+ $ this ->assertTrue (strlen ($ p ->name ) > 0 );
56+ // $this->assertTrue(strlen($p->projectCategory['name']) > 0);
4757
48- foreach ($ prjs as $ p ) {
49- $ this ->assertTrue ($ p instanceof Project);
50- $ this ->assertTrue (strlen ($ p ->key ) > 0 );
51- $ this ->assertTrue (!empty ($ p ->id ));
52- $ this ->assertTrue (strlen ($ p ->name ) > 0 );
53- // $this->assertTrue(strlen($p->projectCategory['name']) > 0);
54- }
5558 } catch (\Exception $ e ) {
56- $ this ->fail ('get_project_lists ' . $ e ->getMessage ());
59+ $ this ->fail ('get_project_info ' . $ e ->getMessage ());
5760 }
61+
62+ return $ projKey ;
5863 }
5964
6065 /**
6166 * @test
62- * @depends get_project_lists
67+ * @depends get_project_info
6368 */
64- public function get_project_types () : void
69+ public function get_project_types (string $ projKey ) : string
6570 {
6671 try {
6772 $ proj = new ProjectService ();
6873
69- $ prjtyps = $ proj ->getProjectTypes ();
74+ $ projectTypes = $ proj ->getProjectTypes ();
7075
71- foreach ($ prjtyps as $ pt ) {
76+ foreach ($ projectTypes as $ pt ) {
7277 $ this ->assertTrue ($ pt instanceof ProjectType);
7378 $ this ->assertTrue (strlen ($ pt ->key ) > 0 );
7479 $ this ->assertTrue (strlen ($ pt ->formattedKey ) > 0 );
@@ -79,65 +84,71 @@ public function get_project_types() : void
7984 } catch (\Exception $ e ) {
8085 $ this ->fail ('get_project_types ' . $ e ->getMessage ());
8186 }
87+
88+ return $ projKey ;
8289 }
8390
8491 /**
8592 * @test
8693 * @depends get_project_types
8794 *
8895 */
89- public function get_project_type ( ) : void
96+ public function get_software_project_types_only ( string $ projKey ) : string
9097 {
9198 try {
9299 $ proj = new ProjectService ();
93100
94- $ prjtyp = $ proj ->getProjectType ('software ' );
101+ $ projectType = $ proj ->getProjectType ('software ' );
95102
96- $ this ->assertTrue ($ prjtyp instanceof ProjectType);
97- $ this ->assertTrue (strlen ($ prjtyp ->key ) > 0 );
98- $ this ->assertTrue (strlen ($ prjtyp ->formattedKey ) > 0 );
99- $ this ->assertTrue (strlen ($ prjtyp ->descriptionI18nKey ) > 0 );
100- $ this ->assertTrue (strlen ($ prjtyp ->color ) > 0 );
101- $ this ->assertTrue (strlen ($ prjtyp ->icon ) > 0 );
103+ $ this ->assertTrue ($ projectType instanceof ProjectType);
104+ $ this ->assertTrue (strlen ($ projectType ->key ) > 0 );
105+ $ this ->assertTrue (strlen ($ projectType ->formattedKey ) > 0 );
106+ $ this ->assertTrue (strlen ($ projectType ->descriptionI18nKey ) > 0 );
107+ $ this ->assertTrue (strlen ($ projectType ->color ) > 0 );
108+ $ this ->assertTrue (strlen ($ projectType ->icon ) > 0 );
102109 } catch (\Exception $ e ) {
103110 $ this ->fail ('get_project_type ' . $ e ->getMessage ());
104111 }
112+
113+ return $ projKey ;
105114 }
106115
107116
108117 /**
109118 * @test
110- * @depends get_project_types
119+ * @depends get_software_project_types_only
111120 *
112121 */
113- public function get_project_accessible () : void
122+ public function get_project_accessible (string $ projKey ) : string
114123 {
115124 try {
116125 $ proj = new ProjectService ();
117126
118- $ prjtyp = $ proj ->getAccessibleProjectType ('business ' );
127+ $ projectType = $ proj ->getAccessibleProjectType ('business ' );
119128
120- $ this ->assertTrue ($ prjtyp instanceof ProjectType);
121- $ this ->assertTrue (strlen ($ prjtyp ->key ) > 0 );
122- $ this ->assertTrue (strlen ($ prjtyp ->formattedKey ) > 0 );
123- $ this ->assertTrue (strlen ($ prjtyp ->descriptionI18nKey ) > 0 );
124- $ this ->assertTrue (strlen ($ prjtyp ->color ) > 0 );
125- $ this ->assertTrue (strlen ($ prjtyp ->icon ) > 0 );
129+ $ this ->assertTrue ($ projectType instanceof ProjectType);
130+ $ this ->assertTrue (strlen ($ projectType ->key ) > 0 );
131+ $ this ->assertTrue (strlen ($ projectType ->formattedKey ) > 0 );
132+ $ this ->assertTrue (strlen ($ projectType ->descriptionI18nKey ) > 0 );
133+ $ this ->assertTrue (strlen ($ projectType ->color ) > 0 );
134+ $ this ->assertTrue (strlen ($ projectType ->icon ) > 0 );
126135 } catch (\Exception $ e ) {
127136 $ this ->fail ('get_project_accessible ' . $ e ->getMessage ());
128137 }
138+
139+ return $ projKey ;
129140 }
130141
131142 /**
132143 * @test
133144 * @depends get_project_accessible
134145 */
135- public function get_project_version () : void
146+ public function get_project_version (string $ projKey ) : string
136147 {
137148 try {
138149 $ proj = new ProjectService ();
139150
140- $ prjs = $ proj ->getVersions (' TEST ' );
151+ $ prjs = $ proj ->getVersions ($ projKey );
141152
142153 $ this ->assertNull ($ prjs );
143154 $ this ->assertTrue ($ prjs instanceof \ArrayObject);
@@ -146,23 +157,27 @@ public function get_project_version() : void
146157 } catch (\Exception $ e ) {
147158 $ this ->fail ('get_project_version ' . $ e ->getMessage ());
148159 }
160+
161+ return $ projKey ;
149162 }
150163
151164 /**
152165 * @test
153166 * @depends get_project_accessible
154167 *
155168 */
156- public function get_unknown_project_type_expect_to_JiraException () : void
169+ public function get_unknown_project_type_expect_to_JiraException (string $ projKey ) : string
157170 {
158171 try {
159172 $ proj = new ProjectService ();
160173
161174 $ this ->expectException (JiraException::class);
162175
163- $ prjtyp = $ proj ->getProjectType ('foobar ' );
176+ $ projectType = $ proj ->getProjectType ('foobar ' );
164177 } catch (\Exception $ e ) {
165178 $ this ->fail ('get_project_type ' . $ e ->getMessage ());
166179 }
180+
181+ return $ projKey ;
167182 }
168183}
0 commit comments