Skip to content
Merged
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
64 changes: 58 additions & 6 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,22 @@ jobs:
if: "${{ matrix.deps == 'low' }}"

- name: "Run PHPUnit"
run: "vendor/bin/phpunit -c ci/github/phpunit/sqlite.xml"
run: "vendor/bin/phpunit -c ci/github/phpunit/sqlite.xml --coverage-clover=coverage-no-cache.xml"
env:
ENABLE_SECOND_LEVEL_CACHE: 0

- name: "Run PHPUnit with Second Level Cache"
run: "vendor/bin/phpunit -c ci/github/phpunit/sqlite.xml --exclude-group performance,non-cacheable,locking_functional"
run: "vendor/bin/phpunit -c ci/github/phpunit/sqlite.xml --exclude-group performance,non-cacheable,locking_functional --coverage-clover=coverage-cache.xml"
env:
ENABLE_SECOND_LEVEL_CACHE: 1

- name: "Upload coverage file"
uses: "actions/upload-artifact@v2"
with:
name: "phpunit-sqlite-${{ matrix.deps }}-${{ matrix.php-version }}-coverage"
path: "coverage*.xml"


phpunit-postgres:
name: "PHPUnit with PostgreSQL"
runs-on: "ubuntu-20.04"
Expand Down Expand Up @@ -112,7 +119,14 @@ jobs:
run: "composer update --no-interaction --no-progress --no-suggest"

- name: "Run PHPUnit"
run: "vendor/bin/phpunit -c ci/github/phpunit/pdo_pgsql.xml"
run: "vendor/bin/phpunit -c ci/github/phpunit/pdo_pgsql.xml --coverage-clover=coverage.xml"

- name: "Upload coverage file"
uses: "actions/upload-artifact@v2"
with:
name: "${{ github.job }}-${{ matrix.postgres-version }}-${{ matrix.php-version }}-coverage"
path: "coverage.xml"


phpunit-mariadb:
name: "PHPUnit with MariaDB"
Expand Down Expand Up @@ -167,7 +181,14 @@ jobs:
run: "composer update --no-interaction --no-progress --no-suggest"

- name: "Run PHPUnit"
run: "vendor/bin/phpunit -c ci/github/phpunit/${{ matrix.extension }}.xml"
run: "vendor/bin/phpunit -c ci/github/phpunit/${{ matrix.extension }}.xml --coverage-clover=coverage.xml"

- name: "Upload coverage file"
uses: "actions/upload-artifact@v2"
with:
name: "${{ github.job }}-${{ matrix.mariadb-version }}-${{ matrix.extension }}-${{ matrix.php-version }}-coverage"
path: "coverage.xml"


phpunit-mysql:
name: "PHPUnit with MySQL"
Expand Down Expand Up @@ -222,11 +243,42 @@ jobs:
run: "composer update --no-interaction --no-progress --no-suggest"

- name: "Run PHPUnit"
run: "vendor/bin/phpunit -c ci/github/phpunit/${{ matrix.extension }}.xml"
run: "vendor/bin/phpunit -c ci/github/phpunit/${{ matrix.extension }}.xml --coverage-clover=coverage-no-cache.xml"
env:
ENABLE_SECOND_LEVEL_CACHE: 0

- name: "Run PHPUnit with Second Level Cache"
run: "vendor/bin/phpunit -c ci/github/phpunit/${{ matrix.extension }}.xml --exclude-group performance,non-cacheable,locking_functional"
run: "vendor/bin/phpunit -c ci/github/phpunit/${{ matrix.extension }}.xml --exclude-group performance,non-cacheable,locking_functional --coverage-clover=coverage-no-cache.xml"
env:
ENABLE_SECOND_LEVEL_CACHE: 1

- name: "Upload coverage files"
uses: "actions/upload-artifact@v2"
with:
name: "${{ github.job }}-${{ matrix.mysql-version }}-${{ matrix.extension }}-${{ matrix.php-version }}-coverage"
path: "coverage*.xml"

upload_coverage:
name: "Upload coverage to Codecov"
runs-on: "ubuntu-20.04"
needs:
- "phpunit-smoke-check"
- "phpunit-postgres"
- "phpunit-mariadb"
- "phpunit-mysql"

steps:
- name: "Checkout"
uses: "actions/checkout@v2"
with:
fetch-depth: 2

- name: "Download coverage files"
uses: "actions/download-artifact@v2"
with:
path: "reports"

- name: "Upload to Codecov"
uses: "codecov/codecov-action@v1"
with:
directory: reports
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ vendor/
/tests/Doctrine/Performance/history.db
/.phpcs-cache
composer.lock
/.phpunit.result.cache
8 changes: 4 additions & 4 deletions ci/github/phpunit/mysqli.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@
</testsuite>
</testsuites>

<coverage>
<include>
<filter>
<whitelist>
<directory suffix=".php">../../../lib/Doctrine</directory>
</include>
</coverage>
</whitelist>
</filter>

<groups>
<exclude>
Expand Down
9 changes: 5 additions & 4 deletions ci/github/phpunit/pdo_mysql.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@
</testsuite>
</testsuites>

<coverage>
<include>
<filter>
<whitelist>
<directory suffix=".php">../../../lib/Doctrine</directory>
</include>
</coverage>
</whitelist>
</filter>


<groups>
<exclude>
Expand Down
8 changes: 4 additions & 4 deletions ci/github/phpunit/pdo_pgsql.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@
</testsuite>
</testsuites>

<coverage>
<include>
<filter>
<whitelist>
<directory suffix=".php">../../../lib/Doctrine</directory>
</include>
</coverage>
</whitelist>
</filter>

<groups>
<exclude>
Expand Down
8 changes: 4 additions & 4 deletions ci/github/phpunit/sqlite.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
</testsuite>
</testsuites>

<coverage>
<include>
<filter>
<whitelist>
<directory suffix=".php">../../../lib/Doctrine</directory>
</include>
</coverage>
</whitelist>
</filter>

<groups>
<exclude>
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"require-dev": {
"doctrine/coding-standard": "^6.0",
"phpstan/phpstan": "^0.12.18",
"phpunit/phpunit": "^7.5",
"phpunit/phpunit": "^8.0",
"symfony/yaml": "^3.4|^4.0|^5.0",
"vimeo/psalm": "^3.11"
},
Expand Down
5 changes: 1 addition & 4 deletions tests/Doctrine/Tests/DbalFunctionalTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,7 @@ protected function resetSharedConn()
self::$_sharedConn = null;
}

/**
* @return void
*/
protected function setUp()
protected function setUp() : void
{
if (isset($this->sharedFixture['conn'])) {
$this->_conn = $this->sharedFixture['conn'];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ final class UnderscoreNamingStrategyTest extends TestCase
/** @test */
public function checkDeprecationMessage() : void
{
$this->expectDeprecationMessage('Creating Doctrine\ORM\Mapping\UnderscoreNamingStrategy without making it number aware is deprecated and will be removed in Doctrine ORM 3.0.');
$this->expectDeprecationMessageSame('Creating Doctrine\ORM\Mapping\UnderscoreNamingStrategy without making it number aware is deprecated and will be removed in Doctrine ORM 3.0.');
new UnderscoreNamingStrategy(CASE_LOWER, false);
}
}
2 changes: 1 addition & 1 deletion tests/Doctrine/Tests/ORM/Cache/AbstractRegionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ abstract class AbstractRegionTest extends OrmFunctionalTestCase
*/
protected $cache;

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

Expand Down
2 changes: 1 addition & 1 deletion tests/Doctrine/Tests/ORM/Cache/CacheConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class CacheConfigTest extends DoctrineTestCase
/**
* {@inheritDoc}
*/
protected function setUp()
protected function setUp() : void
{
parent::setUp();

Expand Down
2 changes: 1 addition & 1 deletion tests/Doctrine/Tests/ORM/Cache/CacheLoggerChainTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class CacheLoggerChainTest extends DoctrineTestCase
*/
private $mock;

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

Expand Down
2 changes: 1 addition & 1 deletion tests/Doctrine/Tests/ORM/Cache/DefaultCacheFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class DefaultCacheFactoryTest extends OrmTestCase
*/
private $regionsConfig;

protected function setUp()
protected function setUp() : void
{
$this->enableSecondLevelCache();
parent::setUp();
Expand Down
2 changes: 1 addition & 1 deletion tests/Doctrine/Tests/ORM/Cache/DefaultCacheTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class DefaultCacheTest extends OrmTestCase
*/
private $em;

protected function setUp()
protected function setUp() : void
{
parent::enableSecondLevelCache();
parent::setUp();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class DefaultCollectionHydratorTest extends OrmFunctionalTestCase
*/
private $structure;

protected function setUp()
protected function setUp() : void
{
$this->enableSecondLevelCache();
parent::setUp();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class DefaultEntityHydratorTest extends OrmTestCase
*/
private $em;

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

Expand Down
20 changes: 7 additions & 13 deletions tests/Doctrine/Tests/ORM/Cache/DefaultQueryCacheTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class DefaultQueryCacheTest extends OrmTestCase
*/
private $cacheFactory;

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

Expand Down Expand Up @@ -640,12 +640,10 @@ public function testGetAssociationValue()
$this->assertCount(1, $attractions[1]);
}

/**
* @expectedException Doctrine\ORM\Cache\CacheException
* @expectedExceptionMessage Second level cache does not support scalar results.
*/
public function testScalarResultException()
{
$this->expectException('Doctrine\ORM\Cache\CacheException');
$this->expectExceptionMessage('Second level cache does not support scalar results.');
$result = [];
$key = new QueryCacheKey('query.key1', 0);
$rsm = new ResultSetMappingBuilder($this->em);
Expand All @@ -655,12 +653,10 @@ public function testScalarResultException()
$this->queryCache->put($key, $rsm, $result);
}

/**
* @expectedException Doctrine\ORM\Cache\CacheException
* @expectedExceptionMessage Second level cache does not support multiple root entities.
*/
public function testSupportMultipleRootEntitiesException()
{
$this->expectException('Doctrine\ORM\Cache\CacheException');
$this->expectExceptionMessage('Second level cache does not support multiple root entities.');
$result = [];
$key = new QueryCacheKey('query.key1', 0);
$rsm = new ResultSetMappingBuilder($this->em);
Expand All @@ -671,12 +667,10 @@ public function testSupportMultipleRootEntitiesException()
$this->queryCache->put($key, $rsm, $result);
}

/**
* @expectedException Doctrine\ORM\Cache\CacheException
* @expectedExceptionMessage Entity "Doctrine\Tests\Models\Generic\BooleanModel" not configured as part of the second-level cache.
*/
public function testNotCacheableEntityException()
{
$this->expectException('Doctrine\ORM\Cache\CacheException');
$this->expectExceptionMessage('Entity "Doctrine\Tests\Models\Generic\BooleanModel" not configured as part of the second-level cache.');
$result = [];
$key = new QueryCacheKey('query.key1', 0);
$rsm = new ResultSetMappingBuilder($this->em);
Expand Down
2 changes: 1 addition & 1 deletion tests/Doctrine/Tests/ORM/Cache/FileLockRegionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class FileLockRegionTest extends AbstractRegionTest
/**
* {@inheritDoc}
*/
public function tearDown()
public function tearDown() : void
{
$this->cleanTestDirectory($this->directory);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ abstract class AbstractCollectionPersisterTest extends OrmTestCase
*/
abstract protected function createPersister(EntityManager $em, CollectionPersister $persister, Region $region, array $mapping);

protected function setUp()
protected function setUp() : void
{
$this->getSharedSecondLevelCacheDriverImpl()->flushAll();
$this->enableSecondLevelCache();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ abstract class AbstractEntityPersisterTest extends OrmTestCase
*/
abstract protected function createPersister(EntityManager $em, EntityPersister $persister, Region $region, ClassMetadata $metadata);

protected function setUp()
protected function setUp() : void
{
$this->getSharedSecondLevelCacheDriverImpl()->flushAll();
$this->enableSecondLevelCache();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,10 @@ protected function createPersister(EntityManager $em, EntityPersister $persister
return new ReadOnlyCachedEntityPersister($persister, $region, $em, $metadata);
}

/**
* @expectedException Doctrine\ORM\Cache\CacheException
* @expectedExceptionMessage Cannot update a readonly entity "Doctrine\Tests\Models\Cache\Country"
*/
public function testInvokeUpdate()
{
$this->expectException('Doctrine\ORM\Cache\CacheException');
$this->expectExceptionMessage('Cannot update a readonly entity "Doctrine\Tests\Models\Cache\Country"');
$persister = $this->createPersisterDefault();
$entity = new Country("Foo");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class StatisticsCacheLoggerTest extends DoctrineTestCase
*/
private $logger;

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

Expand Down
4 changes: 2 additions & 2 deletions tests/Doctrine/Tests/ORM/CommitOrderCalculatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class CommitOrderCalculatorTest extends OrmTestCase
{
private $_calc;

protected function setUp()
protected function setUp() : void
{
$this->_calc = new CommitOrderCalculator();
}
Expand Down Expand Up @@ -98,7 +98,7 @@ public function testCommitOrdering3()
];

// We want to perform a strict comparison of the array
$this->assertContains($sorted, $correctOrders, '', false, true, true);
$this->assertContains($sorted, $correctOrders, '', false, true);
}
}

Expand Down
2 changes: 1 addition & 1 deletion tests/Doctrine/Tests/ORM/ConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class ConfigurationTest extends TestCase
*/
private $configuration;

protected function setUp()
protected function setUp() : void
{
parent::setUp();
$this->configuration = new Configuration();
Expand Down
Loading