File tree Expand file tree Collapse file tree 2 files changed +46
-2
lines changed Expand file tree Collapse file tree 2 files changed +46
-2
lines changed Original file line number Diff line number Diff line change @@ -85,11 +85,28 @@ public function all(array $parameters = [])
85
85
86
86
/**
87
87
* @param int $project_id
88
+ * @param array $parameters {
89
+ *
90
+ * @var bool $statistics Include project statistics.
91
+ * @var bool $with_custom_attributes Include project custom attributes.
92
+ * }
88
93
* @return mixed
89
94
*/
90
- public function show ($ project_id )
95
+ public function show ($ project_id, array $ parameters = [] )
91
96
{
92
- return $ this ->get ('projects/ ' .$ this ->encodePath ($ project_id ));
97
+ $ resolver = $ this ->createOptionsResolver ();
98
+ $ booleanNormalizer = function (Options $ resolver , $ value ) {
99
+ return $ value ? true : false ;
100
+ };
101
+ $ resolver ->setDefined ('statistics ' )
102
+ ->setAllowedTypes ('statistics ' , 'bool ' )
103
+ ->setNormalizer ('statistics ' , $ booleanNormalizer )
104
+ ;
105
+ $ resolver ->setDefined ('with_custom_attributes ' )
106
+ ->setAllowedTypes ('with_custom_attributes ' , 'bool ' )
107
+ ->setNormalizer ('with_custom_attributes ' , $ booleanNormalizer )
108
+ ;
109
+ return $ this ->get ('projects/ ' .$ this ->encodePath ($ project_id ), $ resolver ->resolve ($ parameters ));
93
110
}
94
111
95
112
/**
Original file line number Diff line number Diff line change @@ -110,6 +110,33 @@ public function shouldShowProject()
110
110
$ this ->assertEquals ($ expectedArray , $ api ->show (1 ));
111
111
}
112
112
113
+ /**
114
+ * @test
115
+ */
116
+ public function shouldShowProjectWithStatistics ()
117
+ {
118
+ $ expectedArray = array (
119
+ 'id ' => 1 ,
120
+ 'name ' => 'Project Name ' ,
121
+ 'statistics ' => array (
122
+ 'commit_count ' => 37 ,
123
+ 'storage_size ' => 1038090 ,
124
+ 'repository_size ' => 1038090 ,
125
+ 'lfs_objects_size ' => 0 ,
126
+ 'job_artifacts_size ' => 0
127
+ )
128
+ );
129
+
130
+ $ api = $ this ->getApiMock ();
131
+ $ api ->expects ($ this ->once ())
132
+ ->method ('get ' )
133
+ ->with ('projects/1 ' , ['statistics ' => true ])
134
+ ->will ($ this ->returnValue ($ expectedArray ))
135
+ ;
136
+
137
+ $ this ->assertEquals ($ expectedArray , $ api ->show (1 , ['statistics ' => true ]));
138
+ }
139
+
113
140
/**
114
141
* @test
115
142
*/
You can’t perform that action at this time.
0 commit comments