Improve unit tests for the Navigation\NodeFactory class
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
This commit is contained in:
parent
51aab42a7a
commit
f862ade53b
@ -6,6 +6,7 @@ namespace PhpMyAdmin\Tests\Navigation;
|
||||
|
||||
use PhpMyAdmin\Navigation\NodeFactory;
|
||||
use PhpMyAdmin\Navigation\Nodes\Node;
|
||||
use PhpMyAdmin\Navigation\Nodes\NodeDatabase;
|
||||
use PhpMyAdmin\Tests\AbstractTestCase;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
|
||||
@ -46,4 +47,24 @@ class NodeFactoryTest extends AbstractTestCase
|
||||
$this->assertEquals(Node::CONTAINER, $node->type);
|
||||
$this->assertTrue($node->isGroup);
|
||||
}
|
||||
|
||||
public function testDatabaseNode(): void
|
||||
{
|
||||
$node = NodeFactory::getInstance(NodeDatabase::class, 'database_name');
|
||||
$this->assertInstanceOf(NodeDatabase::class, $node);
|
||||
$this->assertEquals('database_name', $node->name);
|
||||
$this->assertEquals(Node::OBJECT, $node->type);
|
||||
$this->assertFalse($node->isGroup);
|
||||
}
|
||||
|
||||
public function testGetInstanceForNewNode(): void
|
||||
{
|
||||
$node = NodeFactory::getInstanceForNewNode('New', 'new_database italics');
|
||||
$this->assertEquals('New', $node->name);
|
||||
$this->assertEquals(Node::OBJECT, $node->type);
|
||||
$this->assertFalse($node->isGroup);
|
||||
$this->assertEquals('New', $node->title);
|
||||
$this->assertTrue($node->isNew);
|
||||
$this->assertEquals('new_database italics', $node->classes);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user