Skip to content
This repository was archived by the owner on Feb 5, 2024. It is now read-only.

Update phpunit #131

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
},
"require-dev": {
"symfony/yaml": "^2.0|^3.0",
"phpunit/phpunit": "^4.8, <5.0"
"phpunit/phpunit": "^6.0.0"
},
"suggest": {
"symfony/yaml": "If you want to use YAML Mappings"
Expand Down
12 changes: 6 additions & 6 deletions tests/Doctrine/Tests/ODM/CouchDB/AttachmentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function testCreateFromBase64Data()

public function testCreateStub()
{
$httpClient = $this->getMock('Doctrine\CouchDB\HTTP\Client');
$httpClient = $this->getMockBuilder('Doctrine\CouchDB\HTTP\Client')->getMock();
$httpClient->expects($this->never())->method('request');
$attachment = Attachment::createStub('plain/text', 28, 2, $httpClient, '/');

Expand All @@ -47,7 +47,7 @@ public function testTriggerStubLazyLoad()
$path = '/';

$response = new \Doctrine\CouchDB\HTTP\Response(200, array(), 'Hello i am a string', true);
$httpClient = $this->getMock('Doctrine\CouchDB\HTTP\Client');
$httpClient = $this->getMockBuilder('Doctrine\CouchDB\HTTP\Client')->getMock();
$httpClient->expects($this->once())
->method('request')
->with($this->equalTo('GET'), $this->equalTo($path))
Expand All @@ -65,14 +65,14 @@ public function testTriggerLazyLoadOfMissingAttachmentThrowsException()
$path = '/';

$errorResponse = new \Doctrine\CouchDB\HTTP\ErrorResponse(404, array(), '{"error":"not_found","reason":"missing"}');
$httpClient = $this->getMock('Doctrine\CouchDB\HTTP\Client');
$httpClient = $this->getMockBuilder('Doctrine\CouchDB\HTTP\Client')->getMock();
$httpClient->expects($this->once())
->method('request')
->with($this->equalTo('GET'), $this->equalTo($path))
->will($this->returnValue( $errorResponse ));
$attachment = Attachment::createStub('plain/text', 28, 2, $httpClient, $path);

$this->setExpectedException('Doctrine\CouchDB\HTTP\HTTPException');
$this->expectException('Doctrine\CouchDB\HTTP\HTTPException');
$attachment->getRawData();
}

Expand All @@ -86,7 +86,7 @@ public function testToArray()

public function testToArrayStub()
{
$httpClient = $this->getMock('Doctrine\CouchDB\HTTP\Client');
$httpClient = $this->getMockBuilder('Doctrine\CouchDB\HTTP\Client')->getMock();
$httpClient->expects($this->never())->method('request');
$attachment = Attachment::createStub('plain/text', 28, 2, $httpClient, '/');

Expand All @@ -100,4 +100,4 @@ public function testCreateFromBinaryFileHandle()
$attachment = Attachment::createFromBinaryData($fh);
$this->assertEquals('Hello i am a string!', $attachment->getRawData());
}
}
}
4 changes: 2 additions & 2 deletions tests/Doctrine/Tests/ODM/CouchDB/ConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public function testDocumentNamespace()
$config->setDocumentNamespaces(array('foo' => 'Documents\Bar'));
$this->assertEquals('Documents\Bar', $config->getDocumentNamespace('foo'));

$this->setExpectedException('Doctrine\ODM\CouchDB\CouchDBException');
$this->expectException('Doctrine\ODM\CouchDB\CouchDBException');
$config->getDocumentNamespace('bar');
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use Doctrine\Common\Cache\ArrayCache;
use Doctrine\Common\Annotations\AnnotationReader;

abstract class CouchDBFunctionalTestCase extends \PHPUnit_Framework_TestCase
abstract class CouchDBFunctionalTestCase extends \PHPUnit\Framework\TestCase
{
private $httpClient = null;

Expand Down
4 changes: 2 additions & 2 deletions tests/Doctrine/Tests/ODM/CouchDB/CouchDBTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Doctrine\Tests\ODM\CouchDB;

abstract class CouchDBTestCase extends \PHPUnit_Framework_TestCase
abstract class CouchDBTestCase extends \PHPUnit\Framework\TestCase
{

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public function testInsertUpdateMultiple()

public function testFindTypeValidation()
{
$this->setExpectedException('Doctrine\ODM\CouchDB\InvalidDocumentTypeException');
$this->expectException('Doctrine\ODM\CouchDB\InvalidDocumentTypeException');
$user = $this->dm->find($this->type.'2', 1);
}

Expand Down
4 changes: 2 additions & 2 deletions tests/Doctrine/Tests/ODM/CouchDB/Functional/MergeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public function testMergeRemovedDocument()

$this->dm->remove($user);

$this->setExpectedException('InvalidArgumentException', 'Removed document detected during merge. Can not merge with a removed document.');
$this->expectException('InvalidArgumentException', 'Removed document detected during merge. Can not merge with a removed document.');
$this->dm->merge($user);
}

Expand Down Expand Up @@ -106,4 +106,4 @@ public function testMergeUnknownAssignedId()
$this->assertNotSame($mergedDoc, $doc);
$this->assertSame($mergedDoc->id, $doc->id);
}
}
}
4 changes: 2 additions & 2 deletions tests/Doctrine/Tests/ODM/CouchDB/Functional/ReferenceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public function testInitializeUnknownReferenceThrowsException()
$dm = $this->createDocumentManager();
$user1 = $dm->getReference('Doctrine\Tests\Models\CMS\CmsUser', 1);

$this->setExpectedException('Doctrine\ODM\CouchDB\DocumentNotFoundException');
$this->expectException('Doctrine\ODM\CouchDB\DocumentNotFoundException');
$user1->getUsername();
}

Expand All @@ -42,4 +42,4 @@ public function testLazyLoadReference()

$this->assertTrue($lazyUser->__isInitialized__);
}
}
}
2 changes: 1 addition & 1 deletion tests/Doctrine/Tests/ODM/CouchDB/HTTP/SocketClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class SocketClientTestCase extends \Doctrine\Tests\ODM\CouchDB\CouchDBFunctional
*/
public static function suite()
{
return new \PHPUnit_Framework_TestSuite( __CLASS__ );
return new \PHPUnit\Framework\TestSuite( __CLASS__ );
}

public function testNoConnectionPossible()
Expand Down
2 changes: 1 addition & 1 deletion tests/Doctrine/Tests/ODM/CouchDB/HTTP/StreamClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class StreamClientTestCase extends \Doctrine\Tests\ODM\CouchDB\CouchDBFunctional
*/
public static function suite()
{
return new \PHPUnit_Framework_TestSuite( __CLASS__ );
return new \PHPUnit\Framework\TestSuite( __CLASS__ );
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
Doctrine\ODM\CouchDB\Mapping\Driver\XmlDriver,
Doctrine\ODM\CouchDB\Mapping\Driver\YamlDriver;

abstract class AbstractMappingDriverTest extends \PHPUnit_Framework_TestCase
abstract class AbstractMappingDriverTest extends \PHPUnit\Framework\TestCase
{
abstract protected function loadDriver();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public function testLoadMetadataForNonDocumentThrowsException()
$reader->addNamespace('Doctrine\ODM\CouchDB\Mapping\Annotations');
$annotationDriver = new \Doctrine\ODM\CouchDB\Mapping\Driver\AnnotationDriver($reader);

$this->setExpectedException('Doctrine\ODM\CouchDB\Mapping\MappingException');
$this->expectException('Doctrine\ODM\CouchDB\Mapping\MappingException');
$annotationDriver->loadMetadataForClass('stdClass', $cm);
}

Expand Down Expand Up @@ -69,4 +69,4 @@ protected function ensureIsLoaded($entityClassName)
{
new $entityClassName;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use Doctrine\ODM\CouchDB\Mapping\ClassMetadataFactory;

class ClassMetadataFactoryTest extends \PHPUnit_Framework_TestCase
class ClassMetadataFactoryTest extends \PHPUnit\Framework\TestCase
{
public function setUp()
{
Expand All @@ -15,7 +15,7 @@ public function testNotMappedThrowsException()
{
$cmf = new ClassMetadataFactory($this->dm);

$this->setExpectedException('Doctrine\ODM\CouchDB\Mapping\MappingException');
$this->expectException('Doctrine\ODM\CouchDB\Mapping\MappingException');
$cmf->getMetadataFor('unknown');
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use Doctrine\ODM\CouchDB\Mapping\ClassMetadata;
use Doctrine\Common\Persistence\Mapping\RuntimeReflectionService;

class ClassMetadataTest extends \PHPUnit_Framework_TestCase
class ClassMetadataTest extends \PHPUnit\Framework\TestCase
{
public function testClassName()
{
Expand Down Expand Up @@ -56,7 +56,7 @@ public function testMapField($cm)
*/
public function testmapFieldWithoutNameThrowsException($cm)
{
$this->setExpectedException('Doctrine\ODM\CouchDB\Mapping\MappingException');
$this->expectException('Doctrine\ODM\CouchDB\Mapping\MappingException');

$cm->mapField(array());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public function testCreateThorwsWhenNoTargetNoMetadata()
$this->arrayDataFixture['embedAny'] = $this->embedAnyFixture;
unset($this->arrayDataFixture['embedAny']['any_2']['doctrine_metadata']);

$this->setExpectedException('InvalidArgumentException');
$this->expectException('InvalidArgumentException');
$instance = $this->serializer->createEmbeddedDocument(
$this->arrayDataFixture,
$embedderMetadata->fieldMappings['embedAny']);
Expand All @@ -136,7 +136,7 @@ public function testCreateMetadataConflict()
$this->metadataFactory->getMetadataFor('Doctrine\Tests\ODM\CouchDB\Mapping\Embedder');

$this->arrayDataFixture['embeds']['two']['type'] = 'Doctrine.Tests.ODM.CouchDB.Mapping.Embedded';
$this->setExpectedException('InvalidArgumentException');
$this->expectException('InvalidArgumentException');
$instance = $this->serializer->createEmbeddedDocument(
$this->arrayDataFixture,
$embedderMetadata->fieldMappings['embedAny']);
Expand Down Expand Up @@ -188,7 +188,7 @@ public function testSerializeMismatchingTargetDocument()

$embedder->embedded = $embedded;

$this->setExpectedException('InvalidArgumentException');
$this->expectException('InvalidArgumentException');
$arrayData = $this->serializer->serializeEmbeddedDocument(
$embedded,
$embedderMetadata->fieldMappings['embedded']);
Expand Down
4 changes: 3 additions & 1 deletion tests/Doctrine/Tests/ODM/CouchDB/Proxy/ProxyFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ public function testReferenceProxyDelegatesLoadingToThePersister()

$query = array('documentName' => '\\'.$modelClass, 'id' => 'SomeUUID');

$uowMock = $this->getMock('Doctrine\ODM\CouchDB\UnitOfWork', array('refresh'), array(), '', false);
$uowMock = $this->getMockBuilder('Doctrine\ODM\CouchDB\UnitOfWork', array('refresh'), array(), '', false)
->disableOriginalConstructor()
->getMock();
$uowMock->expects($this->atLeastOnce())
->method('refresh')
->with($this->isInstanceOf($proxyClass));
Expand Down
6 changes: 3 additions & 3 deletions tests/Doctrine/Tests/ODM/CouchDB/Types/TypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ class TypeTest extends \Doctrine\Tests\ODM\CouchDB\CouchDBTestCase
{
public function testOverwriteNonExistantType()
{
$this->setExpectedException("Doctrine\ODM\CouchDB\Types\TypeException");
$this->expectException("Doctrine\ODM\CouchDB\Types\TypeException");

Type::overrideType('foobar', 'Doctrine\ODM\CouchDB\Types\MixedType');
}

public function testAddExistantType()
{
$this->setExpectedException("Doctrine\ODM\CouchDB\Types\TypeException");
$this->expectException("Doctrine\ODM\CouchDB\Types\TypeException");

Type::addType('mixed', 'Doctrine\ODM\CouchDB\Types\MixedType');
}
Expand All @@ -29,4 +29,4 @@ public function testGetTypesMap()
{
$this->assertArrayHasKey('mixed', Type::getTypesMap());
}
}
}
6 changes: 3 additions & 3 deletions tests/Doctrine/Tests/ODM/CouchDB/UnitOfWorkTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function testTryGetById()

public function testScheduleInsertion()
{
$httpClient = $this->getMock('Doctrine\CouchDB\HTTP\Client', array(), array(), '', false);
$httpClient = $this->getMockBuilder('Doctrine\CouchDB\HTTP\Client', array(), array(), '', false)->getMock();
$httpClient->expects($this->once())
->method('request')
->will($this->returnValue(new \Doctrine\CouchDB\HTTP\Response(404, array(), "{}")));
Expand All @@ -84,7 +84,7 @@ public function testScheduleInsertion()

public function testScheduleInsert_ForAssignedIdGenerator_WithoutId()
{
$this->setExpectedException('Doctrine\ODM\CouchDB\CouchDBException');
$this->expectException('Doctrine\ODM\CouchDB\CouchDBException');

$object = new UoWUser();
$object->username = "bar";
Expand All @@ -102,7 +102,7 @@ public function testScheduleInsert_ForUuidGenerator_QueriesUuidGenerator()
);
$uuidResponse = new \Doctrine\CouchDB\HTTP\Response(200, array(), json_encode(array('uuids' => $uuids)));

$client = $this->getMock('Doctrine\CouchDB\HTTP\Client');
$client = $this->getMockBuilder('Doctrine\CouchDB\HTTP\Client')->getMock();
$client->expects($this->once())
->method('request')
->with($this->equalTo('GET'), $this->equalTo('/_uuids?count=20'))
Expand Down
4 changes: 2 additions & 2 deletions tests/Doctrine/Tests/ODM/CouchDB/View/LuceneQueryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ public function testExecute()
}
JSO;

$doc = $this->getMock('Doctrine\CouchDB\View\DesignDocument');
$doc = $this->getMockBuilder('Doctrine\CouchDB\View\DesignDocument')->getMock();
$doc->expects($this->once())
->method('getData')
->will($this->returnValue(array()));

$client = $this->getMock('Doctrine\CouchDB\HTTP\Client', array(), array(), '', false);
$client = $this->getMockBuilder('Doctrine\CouchDB\HTTP\Client', array(), array(), '', false)->getMock();

$client->expects($this->at(0))
->method('request')
Expand Down