From c322e6c4b4ec6c6b9a3b4e5aa416ffb59c53aed6 Mon Sep 17 00:00:00 2001 From: webeweb Date: Mon, 4 Dec 2023 14:46:11 +0100 Subject: [PATCH] Improve FTP client unit test --- tests/ftp/Client/FtpClientTest.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/tests/ftp/Client/FtpClientTest.php b/tests/ftp/Client/FtpClientTest.php index 791be30e2..eb5fa5d9a 100644 --- a/tests/ftp/Client/FtpClientTest.php +++ b/tests/ftp/Client/FtpClientTest.php @@ -78,8 +78,20 @@ public function testCdup(): void { $obj = $this->client; - $this->assertSame($obj, $obj->chdir($this->remoteDir)); - $this->assertSame($obj, $obj->cdup()); + try { + + $this->assertSame($obj, $obj->chdir($this->remoteDir)); + $this->assertSame($obj, $obj->cdup()); + } catch (Throwable $ex) { + + $msg = implode("", [ + $this->message, + "ftp_cdup failed", + ]); + + $this->assertInstanceOf(FtpException::class, $ex); + $this->assertEquals($msg, $ex->getMessage()); + } $obj->close(); }