From bd23ecdd4710ff07746ab437900df4290e0d426d Mon Sep 17 00:00:00 2001 From: David Beja Date: Sun, 17 Mar 2024 17:49:56 +0100 Subject: [PATCH] Add some comments to CatalogTest --- tests/CatalogTest.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tests/CatalogTest.php b/tests/CatalogTest.php index e86afa9..f66a398 100644 --- a/tests/CatalogTest.php +++ b/tests/CatalogTest.php @@ -5,11 +5,26 @@ use Mariadb\CatalogsPHP\Catalog; use PHPUnit\Framework\TestCase; +/** + * Class PDOStatementMock + * + * A mock for the PDOStatement class + */ class CatalogTest extends TestCase { + /** + * @var Catalog $catalog The Catalog instance to test + */ private $catalog; + + /** + * @var \PDO $pdoMock The PDO mock to inject into the Catalog instance + */ private $pdoMock; + /** + * Set up the test + */ protected function setUp(): void { // Create a mock for the PDO class @@ -19,6 +34,9 @@ protected function setUp(): void $this->catalog = new Catalog('localhost', 3306, 'root', '', null, $this->pdoMock); } + /** + * Test the list method + */ public function testList() { // Mock the PDOStatement for the 'SHOW CATALOGS' query @@ -42,12 +60,18 @@ public function testList() ], $catalogs); } + /** + * Test the getPort method + */ public function testGetPort() { $port = $this->catalog->getPort('test'); $this->assertEquals(3306, $port); } + /** + * Test the create method + */ public function testCreate() { // Configure the PDO mock to return the PDOStatement mock for the 'SHOW CATALOGS' query