@@ -227,68 +227,11 @@ public function testTransferProjectTeam()
227227
228228 /**
229229 * @group projectsCRUD
230+ * @depends testCreateProject
230231 */
231- public function testListProject (): void
232+ public function testListProject ($ data ): void
232233 {
233- // Create a team
234- $ team = $ this ->client ->call (Client::METHOD_POST , '/teams ' , array_merge ([
235- 'content-type ' => 'application/json ' ,
236- 'x-appwrite-project ' => $ this ->getProject ()['$id ' ],
237- ], $ this ->getHeaders ()), [
238- 'teamId ' => ID ::unique (),
239- 'name ' => 'Project Test ' ,
240- ]);
241-
242- $ this ->assertEquals (201 , $ team ['headers ' ]['status-code ' ]);
243-
244- // Create first project
245- $ response = $ this ->client ->call (Client::METHOD_POST , '/projects ' , array_merge ([
246- 'content-type ' => 'application/json ' ,
247- 'x-appwrite-project ' => $ this ->getProject ()['$id ' ],
248- ], $ this ->getHeaders ()), [
249- 'projectId ' => ID ::unique (),
250- 'name ' => 'Project Test ' ,
251- 'teamId ' => $ team ['body ' ]['$id ' ],
252- 'region ' => System::getEnv ('_APP_REGION ' , 'default ' )
253- ]);
254-
255- $ this ->assertEquals (201 , $ response ['headers ' ]['status-code ' ]);
256- $ id = $ response ['body ' ]['$id ' ];
257-
258- // Create second project
259- $ response = $ this ->client ->call (Client::METHOD_POST , '/projects ' , array_merge ([
260- 'content-type ' => 'application/json ' ,
261- 'x-appwrite-project ' => $ this ->getProject ()['$id ' ],
262- ], $ this ->getHeaders ()), [
263- 'projectId ' => ID ::unique (),
264- 'name ' => 'Project Test ' ,
265- 'teamId ' => $ team ['body ' ]['$id ' ],
266- ]);
267-
268- $ this ->assertEquals (201 , $ response ['headers ' ]['status-code ' ]);
269-
270- // Create a third project with different name
271- $ team2 = $ this ->client ->call (Client::METHOD_POST , '/teams ' , array_merge ([
272- 'content-type ' => 'application/json ' ,
273- 'x-appwrite-project ' => $ this ->getProject ()['$id ' ],
274- ], $ this ->getHeaders ()), [
275- 'teamId ' => ID ::unique (),
276- 'name ' => 'Team 1 ' ,
277- ]);
278-
279- $ this ->assertEquals (201 , $ team2 ['headers ' ]['status-code ' ]);
280-
281- $ response = $ this ->client ->call (Client::METHOD_POST , '/projects ' , array_merge ([
282- 'content-type ' => 'application/json ' ,
283- 'x-appwrite-project ' => $ this ->getProject ()['$id ' ],
284- ], $ this ->getHeaders ()), [
285- 'projectId ' => ID ::unique (),
286- 'name ' => 'Team 1 Project ' ,
287- 'teamId ' => $ team2 ['body ' ]['$id ' ],
288- 'region ' => System::getEnv ('_APP_REGION ' , 'default ' )
289- ]);
290-
291- $ this ->assertEquals (201 , $ response ['headers ' ]['status-code ' ]);
234+ $ id = $ data ['projectId ' ];
292235
293236 /**
294237 * Test for SUCCESS
@@ -668,35 +611,11 @@ public function testUpdateProject(): void
668611
669612 /**
670613 * @group smtpAndTemplates
614+ * @depends testCreateProject
671615 */
672- public function testUpdateProjectSMTP (): void
616+ public function testUpdateProjectSMTP ($ data ): array
673617 {
674- // Create a team
675- $ team = $ this ->client ->call (Client::METHOD_POST , '/teams ' , array_merge ([
676- 'content-type ' => 'application/json ' ,
677- 'x-appwrite-project ' => $ this ->getProject ()['$id ' ],
678- ], $ this ->getHeaders ()), [
679- 'teamId ' => ID ::unique (),
680- 'name ' => 'Update Project SMTP Test Team ' ,
681- ]);
682-
683- $ this ->assertEquals (201 , $ team ['headers ' ]['status-code ' ]);
684- $ teamId = $ team ['body ' ]['$id ' ];
685-
686- // Create a project
687- $ response = $ this ->client ->call (Client::METHOD_POST , '/projects ' , array_merge ([
688- 'content-type ' => 'application/json ' ,
689- 'x-appwrite-project ' => $ this ->getProject ()['$id ' ],
690- ], $ this ->getHeaders ()), [
691- 'projectId ' => ID ::unique (),
692- 'name ' => 'Project Test ' ,
693- 'teamId ' => $ teamId ,
694- 'region ' => System::getEnv ('_APP_REGION ' , 'default ' )
695- ]);
696-
697- $ this ->assertEquals (201 , $ response ['headers ' ]['status-code ' ]);
698- $ id = $ response ['body ' ]['$id ' ];
699-
618+ $ id = $ data ['projectId ' ];
700619 $ response = $ this ->client ->call (Client::METHOD_PATCH , '/projects/ ' . $ id . '/smtp ' , array_merge ([
701620 'content-type ' => 'application/json ' ,
702621 'x-appwrite-project ' => $ this ->getProject ()['$id ' ],
@@ -735,6 +654,8 @@ public function testUpdateProjectSMTP(): void
735654 $ this ->assertEquals ('user ' , $ response ['body ' ]['smtpUsername ' ]);
736655 $ this ->assertEquals ('password ' , $ response ['body ' ]['smtpPassword ' ]);
737656 $ this ->assertEquals ('' , $ response ['body ' ]['smtpSecure ' ]);
657+
658+ return $ data ;
738659 }
739660
740661 /**
0 commit comments