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

namespace MongoDB\Tests\Operation;

5
use MongoDB\Collection;
6
use MongoDB\Driver\ReadConcern;
7
use MongoDB\Driver\ReadPreference;
8
use MongoDB\Driver\WriteConcern;
9
use MongoDB\Operation\DropCollection;
10 11 12 13 14 15 16
use MongoDB\Tests\FunctionalTestCase as BaseFunctionalTestCase;

/**
 * Base class for Operation functional tests.
 */
abstract class FunctionalTestCase extends BaseFunctionalTestCase
{
17
    public function setUp()
18
    {
19 20
        parent::setUp();

21
        $this->dropCollection();
22 23 24 25 26 27 28 29
    }

    public function tearDown()
    {
        if ($this->hasFailed()) {
            return;
        }

30
        $this->dropCollection();
31
    }
32 33 34 35 36 37 38 39 40 41

    protected function createDefaultReadConcern()
    {
        return new ReadConcern;
    }

    protected function createDefaultWriteConcern()
    {
        return new WriteConcern(-2);
    }
42 43 44 45 46

    protected function createSession()
    {
        return $this->manager->startSession();
    }
47
}