Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to PHPUnit 8 #7688

Closed
wants to merge 6 commits into from
Closed

Update to PHPUnit 8 #7688

wants to merge 6 commits into from

Conversation

Copy link
Member

@SenseException SenseException left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch of the wrong namings and namespaces that you fixed in this PR 👍

tests/Doctrine/Tests/ORM/Functional/NativeQueryTest.php Outdated Show resolved Hide resolved
tests/Doctrine/Tests/ORM/Functional/NewOperatorTest.php Outdated Show resolved Hide resolved
tests/Doctrine/Tests/ORM/Functional/NewOperatorTest.php Outdated Show resolved Hide resolved
tests/Doctrine/Tests/ORM/Functional/NewOperatorTest.php Outdated Show resolved Hide resolved
tests/Doctrine/Tests/ORM/Functional/NewOperatorTest.php Outdated Show resolved Hide resolved
tests/Doctrine/Tests/ORM/Proxy/ProxyFactoryTest.php Outdated Show resolved Hide resolved
tests/Doctrine/Tests/ORM/UnitOfWorkTest.php Show resolved Hide resolved
tests/Doctrine/Tests/ORM/Functional/Ticket/DDC3123Test.php Outdated Show resolved Hide resolved
@@ -412,7 +412,7 @@ public function testAcceptsEntityManagerInterfaceInstances() : void
$classMetadataFactory->setEntityManager($entityManager);

// not really the cleanest way to check it, but we won't add a getter to the CMF just for the sake of testing.
self::assertAttributeSame($entityManager, 'em', $classMetadataFactory);
// self::assertAttributeSame($entityManager, 'em', $classMetadataFactory);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -382,6 +378,6 @@ public function testResultCacheProfileCanBeRemovedViaSetter() : void
$query->useResultCache(true);
$query->setResultCacheProfile();

self::assertAttributeSame(null, 'queryCacheProfile', $query);
// self::assertAttributeSame(null, 'queryCacheProfile', $query);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@carusogabriel
Copy link
Contributor Author

I'll work on this during the weekend.

@carusogabriel carusogabriel force-pushed the task/update-phpunit-8 branch 3 times, most recently from fe9ed5d to d2fbd38 Compare July 21, 2019 19:06
@carusogabriel carusogabriel force-pushed the task/update-phpunit-8 branch 2 times, most recently from 23ce741 to d9a1781 Compare July 21, 2019 19:23
@carusogabriel carusogabriel removed the WIP label Jul 21, 2019
@carusogabriel carusogabriel added this to the 3.0 milestone Jul 21, 2019
Copy link
Member

@lcobucci lcobucci left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes me quite happy, thanks!

@@ -39,8 +38,8 @@ public function testIssue() : void
$listener
->expects($this->once())
->method(Events::postFlush)
->will($this->returnCallback(static function () use ($uow, $test) {
$test->assertAttributeEmpty('extraUpdates', $uow, 'ExtraUpdates are reset before postFlush');
->will($this->returnCallback(static function () use ($uow) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please simplify this to willReturnCallback()?

@@ -171,4 +172,22 @@ protected function getSharedSecondLevelCacheDriverImpl()

return $this->secondLevelCacheDriverImpl;
}

public static function assertAttributeEmpty(string $haystackAttributeName, $haystackClassOrObject, string $message = '') : void
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd avoid porting these methods to our test case. We should rather find alternative ways to test - compare objects with assertEquals(), for example.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was @jwage's idea: #7688 (comment).

I've replaced with assertEquals and methods calling as much as I can, but there are cases that we can't 😕

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see... how many methods are using them?
Can we keep that somewhat contained? Maybe a trait that gets used only when it's really necessary?

Copy link
Member

@SenseException SenseException left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have nothing to add but a question about an assert. If the other change requests are done, this is 👍 from my side.

@@ -405,7 +401,7 @@ public function testResultCacheProfileCanBeRemovedViaSetter() : void
$query->useResultCache(true);
$query->setResultCacheProfile();

self::assertAttributeSame(null, 'queryCacheProfile', $query);
self::assertAttributeEmpty('queryCacheProfile', $query);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This assert uses empty() and changes behavior of a test compared to the previous used check of null. But this property contains usually an object. Should we keep it that way?

@carusogabriel
Copy link
Contributor Author

Closing as I won't on this anymore.

@carusogabriel carusogabriel deleted the task/update-phpunit-8 branch June 17, 2020 02:00
@carusogabriel carusogabriel removed this from the 3.0 milestone Jun 17, 2020
@carusogabriel carusogabriel removed the request for review from jwage June 17, 2020 02:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants