Commit 76cabea9 authored by Jeremy Mikola's avatar Jeremy Mikola

Fix namespaces in test classes

The Operation classes were previously relying on MongoDB\Tests\Collection\FunctionalTestCase, so they required additional changes to initialize a Collection instance for asserting outcome of write operations.
parent bac5b9bc
<?php <?php
namespace MongoDB\Tests; namespace MongoDB\Tests\Model;
use MongoDB\Model\BSONArray; use MongoDB\Model\BSONArray;
use MongoDB\Model\BSONDocument; use MongoDB\Model\BSONDocument;
use MongoDB\Tests\TestCase;
class BSONArrayTest extends TestCase class BSONArrayTest extends TestCase
{ {
......
<?php <?php
namespace MongoDB\Tests; namespace MongoDB\Tests\Model;
use MongoDB\Model\BSONArray; use MongoDB\Model\BSONArray;
use MongoDB\Model\BSONDocument; use MongoDB\Model\BSONDocument;
use MongoDB\Tests\TestCase;
use ArrayObject; use ArrayObject;
class BSONDocumentTest extends TestCase class BSONDocumentTest extends TestCase
......
<?php <?php
namespace MongoDB\Tests; namespace MongoDB\Tests\Model;
use MongoDB\Model\CollectionInfo; use MongoDB\Model\CollectionInfo;
use MongoDB\Tests\TestCase; use MongoDB\Tests\TestCase;
......
<?php <?php
namespace MongoDB\Tests; namespace MongoDB\Tests\Model;
use MongoDB\Model\DatabaseInfo; use MongoDB\Model\DatabaseInfo;
use MongoDB\Tests\TestCase; use MongoDB\Tests\TestCase;
......
<?php <?php
namespace MongoDB\Tests; namespace MongoDB\Tests\Model;
use MongoDB\Model\IndexInfo; use MongoDB\Model\IndexInfo;
use MongoDB\Tests\TestCase; use MongoDB\Tests\TestCase;
......
<?php <?php
namespace MongoDB\Tests; namespace MongoDB\Tests\Model;
use MongoDB\Model\IndexInput; use MongoDB\Model\IndexInput;
use MongoDB\Tests\TestCase; use MongoDB\Tests\TestCase;
......
<?php <?php
namespace MongoDB\Tests; namespace MongoDB\Tests\Model;
use MongoDB\Model\TypeMapArrayIterator; use MongoDB\Model\TypeMapArrayIterator;
use MongoDB\Tests\TestCase;
class TypeMapArrayIteratorTest extends TestCase class TypeMapArrayIteratorTest extends TestCase
{ {
......
<?php <?php
namespace MongoDB\Tests\Collection; namespace MongoDB\Tests\Operation;
use MongoDB\BulkWriteResult; use MongoDB\BulkWriteResult;
use MongoDB\Collection;
use MongoDB\Driver\BulkWrite as Bulk; use MongoDB\Driver\BulkWrite as Bulk;
use MongoDB\Driver\WriteConcern; use MongoDB\Driver\WriteConcern;
use MongoDB\Model\BSONDocument; use MongoDB\Model\BSONDocument;
...@@ -10,12 +11,14 @@ use MongoDB\Operation\BulkWrite; ...@@ -10,12 +11,14 @@ use MongoDB\Operation\BulkWrite;
class BulkWriteFunctionalTest extends FunctionalTestCase class BulkWriteFunctionalTest extends FunctionalTestCase
{ {
private $collection;
private $omitModifiedCount; private $omitModifiedCount;
public function setUp() public function setUp()
{ {
parent::setUp(); parent::setUp();
$this->collection = new Collection($this->manager, $this->getDatabaseName(), $this->getCollectionName());
$this->omitModifiedCount = version_compare($this->getServerVersion(), '2.6.0', '<'); $this->omitModifiedCount = version_compare($this->getServerVersion(), '2.6.0', '<');
} }
......
<?php <?php
namespace MongoDB\Tests\Collection; namespace MongoDB\Tests\Operation;
use MongoDB\DeleteResult; use MongoDB\DeleteResult;
use MongoDB\Collection;
use MongoDB\Driver\BulkWrite; use MongoDB\Driver\BulkWrite;
use MongoDB\Driver\WriteConcern; use MongoDB\Driver\WriteConcern;
use MongoDB\Operation\Delete; use MongoDB\Operation\Delete;
class DeleteFunctionalTest extends FunctionalTestCase class DeleteFunctionalTest extends FunctionalTestCase
{ {
private $collection;
public function setUp()
{
parent::setUp();
$this->collection = new Collection($this->manager, $this->getDatabaseName(), $this->getCollectionName());
}
public function testDeleteOne() public function testDeleteOne()
{ {
$this->createFixtures(3); $this->createFixtures(3);
......
<?php <?php
namespace MongoDB\Tests\Collection; namespace MongoDB\Tests\Operation;
use MongoDB\Collection;
use MongoDB\InsertManyResult; use MongoDB\InsertManyResult;
use MongoDB\Driver\WriteConcern; use MongoDB\Driver\WriteConcern;
use MongoDB\Model\BSONDocument; use MongoDB\Model\BSONDocument;
...@@ -9,6 +10,15 @@ use MongoDB\Operation\InsertMany; ...@@ -9,6 +10,15 @@ use MongoDB\Operation\InsertMany;
class InsertManyFunctionalTest extends FunctionalTestCase class InsertManyFunctionalTest extends FunctionalTestCase
{ {
private $collection;
public function setUp()
{
parent::setUp();
$this->collection = new Collection($this->manager, $this->getDatabaseName(), $this->getCollectionName());
}
public function testInsertMany() public function testInsertMany()
{ {
$documents = [ $documents = [
......
<?php <?php
namespace MongoDB\Tests\Collection; namespace MongoDB\Tests\Operation;
use MongoDB\Collection;
use MongoDB\InsertOneResult; use MongoDB\InsertOneResult;
use MongoDB\Driver\WriteConcern; use MongoDB\Driver\WriteConcern;
use MongoDB\Model\BSONDocument; use MongoDB\Model\BSONDocument;
...@@ -9,6 +10,15 @@ use MongoDB\Operation\InsertOne; ...@@ -9,6 +10,15 @@ use MongoDB\Operation\InsertOne;
class InsertOneFunctionalTest extends FunctionalTestCase class InsertOneFunctionalTest extends FunctionalTestCase
{ {
private $collection;
public function setUp()
{
parent::setUp();
$this->collection = new Collection($this->manager, $this->getDatabaseName(), $this->getCollectionName());
}
/** /**
* @dataProvider provideDocumentWithExistingId * @dataProvider provideDocumentWithExistingId
*/ */
......
<?php <?php
namespace MongoDB\Tests\Collection; namespace MongoDB\Tests\Operation;
use MongoDB\Collection;
use MongoDB\UpdateResult; use MongoDB\UpdateResult;
use MongoDB\Driver\BulkWrite; use MongoDB\Driver\BulkWrite;
use MongoDB\Driver\WriteConcern; use MongoDB\Driver\WriteConcern;
...@@ -9,12 +10,14 @@ use MongoDB\Operation\Update; ...@@ -9,12 +10,14 @@ use MongoDB\Operation\Update;
class UpdateFunctionalTest extends FunctionalTestCase class UpdateFunctionalTest extends FunctionalTestCase
{ {
private $collection;
private $omitModifiedCount; private $omitModifiedCount;
public function setUp() public function setUp()
{ {
parent::setUp(); parent::setUp();
$this->collection = new Collection($this->manager, $this->getDatabaseName(), $this->getCollectionName());
$this->omitModifiedCount = version_compare($this->getServerVersion(), '2.6.0', '<'); $this->omitModifiedCount = version_compare($this->getServerVersion(), '2.6.0', '<');
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment