Skip to content

Commit

Permalink
Merge pull request #2042 from doctrine/feature/phpunit-8
Browse files Browse the repository at this point in the history
Update to PHPUnit 8
  • Loading branch information
malarzm committed Jul 11, 2019
2 parents a50624c + 14e26a2 commit 85c5ae3
Show file tree
Hide file tree
Showing 36 changed files with 49 additions and 50 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ phpunit.xml
composer.lock
vendor/
.phpcs-cache
.phpunit.result.cache
phpcs.xml
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"doctrine/coding-standard": "^5.0",
"jmikola/geojson": "^1.0",
"phpstan/phpstan": "^0.10.3",
"phpunit/phpunit": "^7.4"
"phpunit/phpunit": "^8.2"
},
"autoload": {
"psr-4": { "Doctrine\\ODM\\MongoDB\\": "lib/Doctrine/ODM/MongoDB" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class GraphLookupTest extends BaseTest
{
use AggregationTestTrait;

public function setUp()
public function setUp() : void
{
parent::setUp();
$this->requireMongoDB34('$graphLookup tests require at least MongoDB 3.4.0');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

class LookupTest extends BaseTest
{
public function setUp()
public function setUp() : void
{
parent::setUp();
$this->requireMongoDB32('$lookup tests require at least MongoDB 3.2.0');
Expand Down
4 changes: 2 additions & 2 deletions tests/Doctrine/ODM/MongoDB/Tests/BaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ abstract class BaseTest extends TestCase
/** @var UnitOfWork */
protected $uow;

public function setUp()
public function setUp() : void
{
$this->dm = $this->createTestDocumentManager();
$this->uow = $this->dm->getUnitOfWork();
}

public function tearDown()
public function tearDown() : void
{
if (! $this->dm) {
return;
Expand Down
6 changes: 3 additions & 3 deletions tests/Doctrine/ODM/MongoDB/Tests/Functional/AtomicSetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,19 @@ class AtomicSetTest extends BaseTest
/** @var CommandLogger */
private $logger;

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

$this->logger = new CommandLogger();
$this->logger->register();
}

public function tearDown()
public function tearDown() : void
{
$this->logger->unregister();

return parent::tearDown();
parent::tearDown();
}

public function testAtomicInsertAndUpdate()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@ class CommitImprovementTest extends BaseTest
/** @var CommandLogger */
private $logger;

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

$this->logger = new CommandLogger();
$this->logger->register();
}

public function tearDown()
public function tearDown() : void
{
$this->logger->unregister();

return parent::tearDown();
parent::tearDown();
}

public function testInsertIncludesAllNestedCollections()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

class CustomTypeTest extends BaseTest
{
public static function setUpBeforeClass()
public static function setUpBeforeClass() : void
{
Type::addType('date_collection', DateCollectionType::class);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

class ReferenceDiscriminatorsDefaultValueTest extends BaseTest
{
public function setUp()
public function setUp() : void
{
parent::setUp();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class DocumentPersisterTest extends BaseTest
/** @var DocumentPersister */
private $documentPersister;

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

class EcommerceTest extends BaseTest
{
public function setUp()
public function setUp() : void
{
parent::setUp();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/
class EnsureShardingTest extends BaseTest
{
public function setUp()
public function setUp() : void
{
parent::setUp();

Expand Down
2 changes: 1 addition & 1 deletion tests/Doctrine/ODM/MongoDB/Tests/Functional/FilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

class FilterTest extends BaseTest
{
public function setUp()
public function setUp() : void
{
parent::setUp();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class PersistentCollectionCloneTest extends BaseTest
private $user1;
private $user2;

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

Expand Down
2 changes: 1 addition & 1 deletion tests/Doctrine/ODM/MongoDB/Tests/Functional/QueryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

class QueryTest extends BaseTest
{
public function setUp()
public function setUp() : void
{
parent::setUp();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

class ReadPreferenceTest extends BaseTest
{
public function setUp()
public function setUp() : void
{
parent::setUp();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

class ReferenceDiscriminatorsTest extends BaseTest
{
public function setUp()
public function setUp() : void
{
parent::setUp();
$this->dm->getSchemaManager()->ensureDocumentIndexes(CommentableAction::class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

class RepositoriesTest extends BaseTest
{
public function setUp()
public function setUp() : void
{
parent::setUp();

Expand Down
6 changes: 3 additions & 3 deletions tests/Doctrine/ODM/MongoDB/Tests/Functional/ShardKeyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class ShardKeyTest extends BaseTest
/** @var CommandLogger */
private $logger;

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

Expand All @@ -32,11 +32,11 @@ public function setUp()
$this->logger->register();
}

public function tearDown()
public function tearDown() : void
{
$this->logger->unregister();

return parent::tearDown();
parent::tearDown();
}

public function testUpdateAfterSave()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class SimpleReferencesTest extends BaseTest
private $user;
private $test;

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@ class GH1138Test extends BaseTest
/** @var CommandLogger */
private $logger;

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

$this->logger = new CommandLogger();
$this->logger->register();
}

public function tearDown()
public function tearDown() : void
{
$this->logger->unregister();

return parent::tearDown();
parent::tearDown();
}

public function testUpdatingDocumentBeforeItsInsertionShouldNotEntailMultipleQueries()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class GH1229Test extends BaseTest
/**
* {@inheritdoc}
*/
public function setUp()
public function setUp() : void
{
parent::setUp();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

class GH593Test extends BaseTest
{
public function setUp()
public function setUp() : void
{
parent::setUp();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

class GH596Test extends BaseTest
{
public function setUp()
public function setUp() : void
{
parent::setUp();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,13 @@

class MODM166Test extends BaseTest
{
public function setUp()
public function setUp() : void
{
parent::setUp();

$this->listener = new MODM166EventListener();
$evm = $this->dm->getEventManager();
$evm->addEventListener(Events::onFlush, $this->listener);
return $this->dm;
}

public function testUpdateCollectionDuringOnFlushAndRecomputSingleDocumentChangeSet()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,13 @@

class MODM167Test extends BaseTest
{
public function setUp()
public function setUp() : void
{
parent::setUp();

$this->listener = new MODM167EventListener();
$evm = $this->dm->getEventManager();
$evm->addEventListener(Events::onFlush, $this->listener);
return $this->dm;
}

public function testDetatchNewDocumentDuringOnFlush()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class BasicInheritanceMappingTest extends BaseTest
{
private $factory;

public function setUp()
public function setUp() : void
{
parent::setUp();
$this->factory = new ClassMetadataFactory();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ abstract class AbstractDriverTest extends TestCase
{
protected $driver;

public function setUp()
public function setUp() : void
{
// implement driver setup and metadata read
}

public function tearDown()
public function tearDown() : void
{
unset($this->driver);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

class XmlDriverTest extends AbstractDriverTest
{
public function setUp()
public function setUp() : void
{
$this->driver = new XmlDriver(__DIR__ . '/fixtures/xml');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class ShardKeyInheritanceMappingTest extends BaseTest
/** @var ClassMetadataFactory */
private $factory;

public function setUp()
public function setUp() : void
{
parent::setUp();
$this->factory = new ClassMetadataFactory();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ public function testFindMappingNamespaceNotFound()
$driver->getLocator()->findMappingFile('MyOtherNamespace\MySubnamespace\Document\Foo');
}

protected function setUp()
protected function setUp() : void
{
$this->dir = sys_get_temp_dir() . '/abstract_driver_test';
@mkdir($this->dir, 0775, true);
}

protected function tearDown()
protected function tearDown() : void
{
$iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($this->dir), RecursiveIteratorIterator::CHILD_FIRST);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class DefaultPersistentCollectionGeneratorTest extends BaseTest
/** @var DefaultPersistentCollectionGenerator */
private $generator;

public function setUp()
public function setUp() : void
{
parent::setUp();
$this->generator = new DefaultPersistentCollectionGenerator(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ class PersistenceBuilderTest extends BaseTest
{
private $pb;

public function setUp()
public function setUp() : void
{
parent::setUp();
$this->pb = $this->dm->getUnitOfWork()->getPersistenceBuilder();
}

public function tearDown()
public function tearDown() : void
{
unset($this->pb);
parent::tearDown();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class QueryExpressionVisitorTest extends BaseTest
private $queryBuilder;
private $visitor;

public function setUp()
public function setUp() : void
{
parent::setUp();
$this->queryBuilder = $this->dm->createQueryBuilder(Bar::class);
Expand Down
Loading

0 comments on commit 85c5ae3

Please sign in to comment.