File tree Expand file tree Collapse file tree 3 files changed +70
-0
lines changed
Expand file tree Collapse file tree 3 files changed +70
-0
lines changed Original file line number Diff line number Diff line change @@ -126,6 +126,22 @@ public function remove($project_id)
126126 {
127127 return $ this ->delete ('projects/ ' .$ this ->encodePath ($ project_id ));
128128 }
129+
130+ /**
131+ * @param int $project_id
132+ * @return mixed
133+ */
134+ public function archive ($ project_id ){
135+ return $ this ->post ("projects/ " .$ this ->encodePath ($ project_id )."/archive " );
136+ }
137+
138+ /**
139+ * @param int $project_id
140+ * @return mixed
141+ */
142+ public function unarchive ($ project_id ){
143+ return $ this ->post ("projects/ " .$ this ->encodePath ($ project_id )."/unarchive " );
144+ }
129145
130146 /**
131147 * @param int $project_id
Original file line number Diff line number Diff line change @@ -141,6 +141,26 @@ public function update(array $params)
141141
142142 return static ::fromArray ($ this ->getClient (), $ data );
143143 }
144+
145+ /**
146+ * @return Project
147+ */
148+ public function archive ()
149+ {
150+ $ data = $ this ->api ("projects " )->archive ($ this ->id );
151+
152+ return static ::fromArray ($ this ->getClient (), $ data );
153+ }
154+
155+ /**
156+ * @return Project
157+ */
158+ public function unarchive ()
159+ {
160+ $ data = $ this ->api ("projects " )->unarchive ($ this ->id );
161+
162+ return static ::fromArray ($ this ->getClient (), $ data );
163+ }
144164
145165 /**
146166 * @return bool
Original file line number Diff line number Diff line change @@ -142,6 +142,40 @@ public function shouldUpdateProject()
142142 'issues_enabled ' => true
143143 )));
144144 }
145+
146+ /**
147+ * @test
148+ */
149+ public function shouldArchiveProject ()
150+ {
151+ $ expectedArray = array ('id ' => 1 , 'archived ' => true );
152+
153+ $ api = $ this ->getApiMock ();
154+ $ api ->expects ($ this ->once ())
155+ ->method ('post ' )
156+ ->with ('projects/1/archive ' )
157+ ->will ($ this ->returnValue ($ expectedArray ))
158+ ;
159+
160+ $ this ->assertEquals ($ expectedArray , $ api ->archive (1 ));
161+ }
162+
163+ /**
164+ * @test
165+ */
166+ public function shouldUnarchiveProject ()
167+ {
168+ $ expectedArray = array ('id ' => 1 , 'archived ' => false );
169+
170+ $ api = $ this ->getApiMock ();
171+ $ api ->expects ($ this ->once ())
172+ ->method ('post ' )
173+ ->with ('projects/1/unarchive ' )
174+ ->will ($ this ->returnValue ($ expectedArray ))
175+ ;
176+
177+ $ this ->assertEquals ($ expectedArray , $ api ->unarchive (1 ));
178+ }
145179
146180 /**
147181 * @test
You can’t perform that action at this time.
0 commit comments