File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -22,20 +22,35 @@ public function getProjectById($project_id)
22
22
public function getProjectByName ($ name )
23
23
{
24
24
$ project = $ this ->projectModel ->getByName ($ name );
25
+
26
+ if (empty ($ project )) {
27
+ return false ;
28
+ }
29
+
25
30
ProjectAuthorization::getInstance ($ this ->container )->check ($ this ->getClassName (), 'getProjectByName ' , $ project ['id ' ]);
26
31
return $ this ->projectApiFormatter ->withProject ($ project )->format ();
27
32
}
28
33
29
34
public function getProjectByIdentifier ($ identifier )
30
35
{
31
36
$ project = $ this ->projectModel ->getByIdentifier ($ identifier );
37
+
38
+ if (empty ($ project )) {
39
+ return false ;
40
+ }
41
+
32
42
ProjectAuthorization::getInstance ($ this ->container )->check ($ this ->getClassName (), 'getProjectByIdentifier ' , $ project ['id ' ]);
33
43
return $ this ->projectApiFormatter ->withProject ($ project )->format ();
34
44
}
35
45
36
46
public function getProjectByEmail ($ email )
37
47
{
38
48
$ project = $ this ->projectModel ->getByEmail ($ email );
49
+
50
+ if (empty ($ project )) {
51
+ return false ;
52
+ }
53
+
39
54
ProjectAuthorization::getInstance ($ this ->container )->check ($ this ->getClassName (), 'getProjectByEmail ' , $ project ['id ' ]);
40
55
return $ this ->projectApiFormatter ->withProject ($ project )->format ();
41
56
}
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ public function testAll()
11
11
$ this ->assertCreateTeamProject ();
12
12
$ this ->assertGetProjectById ();
13
13
$ this ->assertGetProjectByName ();
14
+ $ this ->assertGetInexistingProjectByName ();
14
15
$ this ->assertGetAllProjects ();
15
16
$ this ->assertUpdateProject ();
16
17
$ this ->assertUpdateProjectIdentifier ();
@@ -42,6 +43,12 @@ public function assertGetProjectByName()
42
43
$ this ->assertEquals ('Description ' , $ project ['description ' ]);
43
44
}
44
45
46
+ public function assertGetInexistingProjectByName ()
47
+ {
48
+ $ project = $ this ->app ->getProjectByName ('inexisting project ' );
49
+ $ this ->assertFalse ($ project );
50
+ }
51
+
45
52
public function assertGetAllProjects ()
46
53
{
47
54
$ projects = $ this ->app ->getAllProjects ();
You can’t perform that action at this time.
0 commit comments