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

namespace MongoDB\Tests\Collection;

use MongoDB\Collection;
6
use MongoDB\Operation\DropCollection;
7 8 9 10 11 12 13 14 15 16 17 18 19 20
use MongoDB\Tests\FunctionalTestCase as BaseFunctionalTestCase;

/**
 * Base class for Collection functional tests.
 */
abstract class FunctionalTestCase extends BaseFunctionalTestCase
{
    protected $collection;

    public function setUp()
    {
        parent::setUp();

        $this->collection = new Collection($this->manager, $this->getNamespace());
21 22
        $operation = new DropCollection($this->getDatabaseName(), $this->getCollectionName());
        $operation->execute($this->getPrimaryServer());
23 24
    }

25 26 27 28 29 30
    public function tearDown()
    {
        if ($this->hasFailed()) {
            return;
        }

31 32
        $operation = new DropCollection($this->getDatabaseName(), $this->getCollectionName());
        $operation->execute($this->getPrimaryServer());
33 34
    }
}