Skip to content

Commit

Permalink
Add some comments to CatalogTest
Browse files Browse the repository at this point in the history
  • Loading branch information
dbeja committed Mar 17, 2024
1 parent 4d60064 commit bd23ecd
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/CatalogTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit bd23ecd

Please sign in to comment.