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

Use dedicated assertContainsOnlyInstancesOf PHPUnit assertion #7440

Merged
merged 1 commit into from
Oct 30, 2018
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,7 @@ public function testQueryCacheFindAllJoinTableEntities() : void

self::assertCount(count($this->attractionsInfo), $result2);
self::assertEquals($queryCount + 1, $this->getCurrentQueryCount());

foreach ($result2 as $entity) {
self::assertInstanceOf(AttractionInfo::class, $entity);
}
self::assertContainsOnlyInstancesOf(AttractionInfo::class, $result2);
}

public function testOneToManyRelationJoinTable() : void
Expand Down Expand Up @@ -231,9 +228,6 @@ public function testQueryCacheShouldBeEvictedOnTimestampUpdate() : void

self::assertCount(count($this->attractionsInfo) + 1, $result2);
self::assertEquals($queryCount + 6, $this->getCurrentQueryCount());

foreach ($result2 as $entity) {
self::assertInstanceOf(AttractionInfo::class, $entity);
}
self::assertContainsOnlyInstancesOf(AttractionInfo::class, $result2);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1151,9 +1151,6 @@ public function testQueryCacheShouldBeEvictedOnTimestampUpdate() : void

self::assertCount(3, $result2);
self::assertEquals($queryCount + 1, $this->getCurrentQueryCount());

foreach ($result2 as $entity) {
self::assertInstanceOf(Country::class, $entity);
}
self::assertContainsOnlyInstancesOf(Country::class, $result2);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,7 @@ public function testQueryCacheFindAll() : void

self::assertCount(count($this->attractions), $result2);
self::assertEquals($queryCount + 1, $this->getCurrentQueryCount());

foreach ($result2 as $entity) {
self::assertInstanceOf(Attraction::class, $entity);
}
self::assertContainsOnlyInstancesOf(Attraction::class, $result2);
}

public function testShouldNotPutOneToManyRelationOnPersist() : void
Expand Down Expand Up @@ -251,9 +248,6 @@ public function testQueryCacheShouldBeEvictedOnTimestampUpdate() : void

self::assertCount(count($this->attractions) + 1, $result2);
self::assertEquals($queryCount + 1, $this->getCurrentQueryCount());

foreach ($result2 as $entity) {
self::assertInstanceOf(Attraction::class, $entity);
}
self::assertContainsOnlyInstancesOf(Attraction::class, $result2);
}
}
8 changes: 2 additions & 6 deletions tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1685Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@ public function testPaginateCount() : void

public function testPaginateIterate() : void
{
foreach ($this->paginator as $ad) {
self::assertInstanceOf(DDC117ArticleDetails::class, $ad);
}
self::assertContainsOnlyInstancesOf(DDC117ArticleDetails::class, $this->paginator);
}

public function testPaginateCountNoOutputWalkers() : void
Expand All @@ -64,8 +62,6 @@ public function testPaginateIterateNoOutputWalkers() : void
$this->expectException(\RuntimeException::class);
$this->expectExceptionMessage('Paginating an entity with foreign key as identifier only works when using the Output Walkers. Call Paginator#setUseOutputWalkers(true) before iterating the paginator.');

foreach ($this->paginator as $ad) {
self::assertInstanceOf(DDC117ArticleDetails::class, $ad);
}
self::assertContainsOnlyInstancesOf(DDC117ArticleDetails::class, $this->paginator);
}
}