DatabaseInfoTest.php 1.01 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
<?php

namespace MongoDB\Tests;

use MongoDB\Model\DatabaseInfo;
use MongoDB\Tests\TestCase;

class DatabaseInfoTest extends TestCase
{
    public function testGetName()
    {
        $info = new DatabaseInfo(array('name' => 'foo'));
        $this->assertSame('foo', $info->getName());
    }

    public function testGetSizeOnDisk()
    {
18
        $info = new DatabaseInfo(array('sizeOnDisk' => 1048576));
19 20 21 22 23 24 25 26 27 28 29
        $this->assertSame(1048576, $info->getSizeOnDisk());
    }

    public function testIsEmpty()
    {
        $info = new DatabaseInfo(array('empty' => false));
        $this->assertFalse($info->isEmpty());

        $info = new DatabaseInfo(array('empty' => true));
        $this->assertTrue($info->isEmpty());
    }
30 31 32 33 34 35 36 37 38 39 40 41

    public function testDebugInfo()
    {
        $expectedInfo = array(
            'name' => 'foo',
            'sizeOnDisk' => 1048576,
            'empty' => false,
        );

        $info = new DatabaseInfo($expectedInfo);
        $this->assertSame($expectedInfo, $info->__debugInfo());
    }
42
}