FunctionalTestCase.php 750 Bytes
Newer Older
1 2 3 4 5 6
<?php

namespace MongoDB\Tests\Collection;

use MongoDB\Collection;
use MongoDB\Tests\FunctionalTestCase as BaseFunctionalTestCase;
7
use Symfony\Bridge\PhpUnit\SetUpTearDownTrait;
8 9 10 11 12 13

/**
 * Base class for Collection functional tests.
 */
abstract class FunctionalTestCase extends BaseFunctionalTestCase
{
14 15
    use SetUpTearDownTrait;

16
    /** @var Collection */
17 18
    protected $collection;

19
    private function doSetUp()
20 21 22
    {
        parent::setUp();

23
        $this->collection = new Collection($this->manager, $this->getDatabaseName(), $this->getCollectionName());
24 25

        $this->dropCollection();
26 27
    }

28
    private function doTearDown()
29 30 31 32 33
    {
        if ($this->hasFailed()) {
            return;
        }

34 35
        $this->dropCollection();
    }
36
}