Skip to content
Draft
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 @@ -104,7 +104,7 @@ protected function doTestApply(?array $properties, array $filterParameters, arra
} catch (\OutOfRangeException) {
}

$this->assertEquals($expectedPipeline, $pipeline);
$this->assertSame($expectedPipeline, $pipeline);
}

protected function buildFilter(?array $properties = null)
Expand Down
4 changes: 2 additions & 2 deletions src/Doctrine/Odm/Tests/Filter/BooleanFilterTestTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function testGetDescription(): void
'dummyBoolean' => null,
]);

$this->assertEquals([
$this->assertSame([
'dummyBoolean' => [
'property' => 'dummyBoolean',
'type' => 'bool',
Expand All @@ -40,7 +40,7 @@ public function testGetDescriptionDefaultFields(): void
{
$filter = $this->buildFilter();

$this->assertEquals([
$this->assertSame([
'dummyBoolean' => [
'property' => 'dummyBoolean',
'type' => 'bool',
Expand Down
2 changes: 1 addition & 1 deletion src/Doctrine/Odm/Tests/Filter/DateFilterTestTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function testGetDescription(): void
{
$filter = $this->buildFilter();

$this->assertEquals([
$this->assertSame([
'dummyDate[before]' => [
'property' => 'dummyDate',
'type' => \DateTimeInterface::class,
Expand Down
4 changes: 2 additions & 2 deletions src/Doctrine/Odm/Tests/Filter/EndSearchFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function testEndSearchSimpleProperty(): void

// The filter populates $context['match'] with the match expression (no pipeline stage added)
$this->assertArrayHasKey('match', $context);
$this->assertEquals(
$this->assertSame(
['$and' => [['name' => new Regex('foo$', '')]]],
$context['match']->getQuery()
);
Expand All @@ -71,7 +71,7 @@ public function testEndSearchCaseInsensitive(): void

$filter->apply($aggregationBuilder, Dummy::class, null, $context);

$this->assertEquals(
$this->assertSame(
['$and' => [['name' => new Regex('foo$', 'i')]]],
$context['match']->getQuery()
);
Expand Down
6 changes: 3 additions & 3 deletions src/Doctrine/Odm/Tests/Filter/ExactFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public function testExactFilterNestedProperty(): void
// Nested property adds $lookup + $unwind stages
$this->assertCount(2, $pipeline);

$this->assertEquals([
$this->assertSame([
'$lookup' => [
'from' => 'RelatedDummy',
'localField' => 'relatedDummy',
Expand Down Expand Up @@ -160,7 +160,7 @@ public function testExactFilterMultiHopNestedProperty(): void
// 2 lookup+unwind pairs = 4 stages
$this->assertCount(4, $pipeline);

$this->assertEquals([
$this->assertSame([
'$lookup' => [
'from' => 'RelatedDummy',
'localField' => 'relatedDummy',
Expand All @@ -171,7 +171,7 @@ public function testExactFilterMultiHopNestedProperty(): void

$this->assertArrayHasKey('$unwind', $pipeline[1]);

$this->assertEquals([
$this->assertSame([
'$lookup' => [
'from' => 'ThirdLevel',
'localField' => 'relatedDummy_lkup.thirdLevel',
Expand Down
2 changes: 1 addition & 1 deletion src/Doctrine/Odm/Tests/Filter/ExistsFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function testGetDescriptionDefaultFields(): void
{
$filter = $this->buildFilter();

$this->assertEquals([
$this->assertSame([
'exists[id]' => [
'property' => 'id',
'type' => 'bool',
Expand Down
2 changes: 1 addition & 1 deletion src/Doctrine/Odm/Tests/Filter/ExistsFilterTestTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function testGetDescription(): void
{
$filter = $this->buildFilter(['name' => null, 'description' => null]);

$this->assertEquals([
$this->assertSame([
'exists[description]' => [
'property' => 'description',
'type' => 'bool',
Expand Down
2 changes: 1 addition & 1 deletion src/Doctrine/Odm/Tests/Filter/NumericFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function testGetDescriptionDefaultFields(): void
{
$filter = $this->buildFilter();

$this->assertEquals([
$this->assertSame([
'id' => [
'property' => 'id',
'type' => 'int',
Expand Down
4 changes: 2 additions & 2 deletions src/Doctrine/Odm/Tests/Filter/NumericFilterTestTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function testGetDescription(): void
'dummyBoolean' => null,
]);

$this->assertEquals([
$this->assertSame([
'id' => [
'property' => 'id',
'type' => 'int',
Expand All @@ -47,7 +47,7 @@ public function testGetDescriptionDefaultFields(): void
{
$filter = $this->buildFilter();

$this->assertEquals([
$this->assertSame([
'id' => [
'property' => 'id',
'type' => 'int',
Expand Down
2 changes: 1 addition & 1 deletion src/Doctrine/Odm/Tests/Filter/OrderFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function testGetDescriptionDefaultFields(): void
{
$filter = $this->buildFilter();

$this->assertEquals([
$this->assertSame([
'order[id]' => [
'property' => 'id',
'type' => 'string',
Expand Down
2 changes: 1 addition & 1 deletion src/Doctrine/Odm/Tests/Filter/OrderFilterTestTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function testGetDescription(): void
{
$filter = $this->buildFilter(['id' => null, 'name' => null, 'foo' => null]);

$this->assertEquals([
$this->assertSame([
'order[id]' => [
'property' => 'id',
'type' => 'string',
Expand Down
2 changes: 1 addition & 1 deletion src/Doctrine/Odm/Tests/Filter/PartialSearchFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public function testPartialSearchNestedProperty(): void
// Nested property adds $lookup + $unwind stages
$this->assertCount(2, $pipeline);

$this->assertEquals([
$this->assertSame([
'$lookup' => [
'from' => 'RelatedDummy',
'localField' => 'relatedDummy',
Expand Down
2 changes: 1 addition & 1 deletion src/Doctrine/Odm/Tests/Filter/RangeFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function testGetDescriptionDefaultFields(): void
{
$filter = $this->buildFilter();

$this->assertEquals([
$this->assertSame([
'id[between]' => [
'property' => 'id',
'type' => 'string',
Expand Down
2 changes: 1 addition & 1 deletion src/Doctrine/Odm/Tests/Filter/SearchFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function testGetDescriptionDefaultFields(): void
{
$filter = self::buildSearchFilter($this, $this->managerRegistry);

$this->assertEquals([
$this->assertSame([
'id' => [
'property' => 'id',
'type' => 'int',
Expand Down
2 changes: 1 addition & 1 deletion src/Doctrine/Odm/Tests/Filter/SearchFilterTestTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function testGetDescription(): void
'relatedDummy' => null,
]);

$this->assertEquals([
$this->assertSame([
'id' => [
'property' => 'id',
'type' => 'int',
Expand Down
18 changes: 9 additions & 9 deletions src/Doctrine/Odm/Tests/Filter/SortFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function testSortAscending(): void
$filter->apply($aggregationBuilder, Dummy::class, null, $context);
$pipeline = $aggregationBuilder->getPipeline();

$this->assertEquals([
$this->assertSame([
['$sort' => ['name' => 1]],
], $pipeline);
}
Expand All @@ -66,7 +66,7 @@ public function testSortDescending(): void
$filter->apply($aggregationBuilder, Dummy::class, null, $context);
$pipeline = $aggregationBuilder->getPipeline();

$this->assertEquals([
$this->assertSame([
['$sort' => ['name' => -1]],
], $pipeline);
}
Expand Down Expand Up @@ -170,7 +170,7 @@ public function testNestedPropertySort(): void
$filter->apply($aggregationBuilder, Dummy::class, null, $context);
$pipeline = $aggregationBuilder->getPipeline();

$this->assertEquals([
$this->assertSame([
[
'$lookup' => [
'from' => 'RelatedDummy',
Expand Down Expand Up @@ -210,7 +210,7 @@ public function testNullsComparison(): void
$this->assertCount(2, $pipeline);
$this->assertArrayHasKey('$addFields', $pipeline[0]);
$this->assertArrayHasKey('_null_rank_dummyDate', $pipeline[0]['$addFields']);
$this->assertEquals(['$sort' => ['_null_rank_dummyDate' => 1, 'dummyDate' => 1]], $pipeline[1]);
$this->assertSame(['$sort' => ['_null_rank_dummyDate' => 1, 'dummyDate' => 1]], $pipeline[1]);
}

public function testGetSchema(): void
Expand All @@ -219,7 +219,7 @@ public function testGetSchema(): void

$parameter = new QueryParameter(property: 'name', key: 'order[name]');

$this->assertEquals(
$this->assertSame(
['type' => 'string', 'enum' => ['asc', 'desc', 'ASC', 'DESC']],
$filter->getSchema($parameter)
);
Expand Down Expand Up @@ -269,7 +269,7 @@ public function testMultiHopNestedPropertySort(): void
// 2 lookup+unwind pairs + 1 sort = 5 stages
$this->assertCount(5, $pipeline);

$this->assertEquals([
$this->assertSame([
'$lookup' => [
'from' => 'RelatedDummy',
'localField' => 'relatedDummy',
Expand All @@ -280,7 +280,7 @@ public function testMultiHopNestedPropertySort(): void

$this->assertArrayHasKey('$unwind', $pipeline[1]);

$this->assertEquals([
$this->assertSame([
'$lookup' => [
'from' => 'ThirdLevel',
'localField' => 'relatedDummy_lkup.thirdLevel',
Expand All @@ -291,7 +291,7 @@ public function testMultiHopNestedPropertySort(): void

$this->assertArrayHasKey('$unwind', $pipeline[3]);

$this->assertEquals([
$this->assertSame([
'$sort' => ['relatedDummy_lkup.thirdLevel_lkup.level' => 1],
], $pipeline[4]);
}
Expand Down Expand Up @@ -335,6 +335,6 @@ public function testLookupDeduplication(): void

// Only $sort should be present — no $lookup/$unwind since they were deduplicated
$this->assertCount(1, $pipeline);
$this->assertEquals(['$sort' => ['relatedDummy_lkup.name' => 1]], $pipeline[0]);
$this->assertSame(['$sort' => ['relatedDummy_lkup.name' => 1]], $pipeline[0]);
}
}
24 changes: 12 additions & 12 deletions src/Doctrine/Odm/Tests/PropertyInfo/DoctrineExtractorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class DoctrineExtractorTest extends TestCase
{
public function testGetProperties(): void
{
$this->assertEquals(
$this->assertSame(
[
'id',
'foo',
Expand Down Expand Up @@ -74,7 +74,7 @@ public function testGetProperties(): void

public function testTestGetPropertiesWithEmbedded(): void
{
$this->assertEquals(
$this->assertSame(
[
'id',
'embedOne',
Expand All @@ -88,7 +88,7 @@ public function testTestGetPropertiesWithEmbedded(): void
#[DataProvider('typesProvider')]
public function testExtract(string $property, ?Type $type): void
{
$this->assertEquals($type, $this->createExtractor()->getType(DoctrineDummy::class, $property));
$this->assertSame($type, $this->createExtractor()->getType(DoctrineDummy::class, $property));
}

#[IgnoreDeprecations]
Expand All @@ -111,12 +111,12 @@ public function testExtractWithEmbedOneLegacy(): void
'embedOne'
);

$this->assertEquals($expectedTypes, $actualTypes);
$this->assertSame($expectedTypes, $actualTypes);
}

public function testExtractWithEmbedOne(): void
{
$this->assertEquals(
$this->assertSame(
Type::object(DoctrineEmbeddable::class),
$this->createExtractor()->getType(DoctrineWithEmbedded::class, 'embedOne'),
);
Expand Down Expand Up @@ -145,12 +145,12 @@ public function testExtractWithEmbedManyLegacy(): void
'embedMany'
);

$this->assertEquals($expectedTypes, $actualTypes);
$this->assertSame($expectedTypes, $actualTypes);
}

public function testExtractWithEmbedMany(): void
{
$this->assertEquals(
$this->assertSame(
Type::collection(Type::object(Collection::class), Type::object(DoctrineEmbeddable::class), Type::int()),
$this->createExtractor()->getType(DoctrineWithEmbedded::class, 'embedMany'),
);
Expand All @@ -163,15 +163,15 @@ public function testExtractEnumLegacy(): void
$this->markTestSkipped();
}

$this->assertEquals([new LegacyType(LegacyType::BUILTIN_TYPE_OBJECT, false, EnumString::class)], $this->createExtractor()->getTypes(DoctrineEnum::class, 'enumString'));
$this->assertEquals([new LegacyType(LegacyType::BUILTIN_TYPE_OBJECT, false, EnumInt::class)], $this->createExtractor()->getTypes(DoctrineEnum::class, 'enumInt'));
$this->assertSame([new LegacyType(LegacyType::BUILTIN_TYPE_OBJECT, false, EnumString::class)], $this->createExtractor()->getTypes(DoctrineEnum::class, 'enumString'));
$this->assertSame([new LegacyType(LegacyType::BUILTIN_TYPE_OBJECT, false, EnumInt::class)], $this->createExtractor()->getTypes(DoctrineEnum::class, 'enumInt'));
$this->assertNull($this->createExtractor()->getTypes(DoctrineEnum::class, 'enumCustom'));
}

public function testExtractEnum(): void
{
$this->assertEquals(Type::enum(EnumString::class), $this->createExtractor()->getType(DoctrineEnum::class, 'enumString'));
$this->assertEquals(Type::enum(EnumInt::class), $this->createExtractor()->getType(DoctrineEnum::class, 'enumInt'));
$this->assertSame(Type::enum(EnumString::class), $this->createExtractor()->getType(DoctrineEnum::class, 'enumString'));
$this->assertSame(Type::enum(EnumInt::class), $this->createExtractor()->getType(DoctrineEnum::class, 'enumInt'));
$this->assertNull($this->createExtractor()->getType(DoctrineEnum::class, 'enumCustom'));
}

Expand Down Expand Up @@ -235,7 +235,7 @@ public function testExtractLegacy(): void
];

foreach ($legacyTypes as [$property, $t]) {
$this->assertEquals($t, $this->createExtractor()->getTypes(DoctrineDummy::class, $property));
$this->assertSame($t, $this->createExtractor()->getTypes(DoctrineDummy::class, $property));
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/Doctrine/Odm/Tests/State/CollectionProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public function testAggregationResultExtension(): void
$extensionProphecy->getResult($aggregationBuilder, ProviderDocument::class, $operation, [])->willReturn([])->shouldBeCalled();

$dataProvider = new CollectionProvider($this->resourceMetadataFactoryProphecy->reveal(), $this->managerRegistryProphecy->reveal(), [$extensionProphecy->reveal()]);
$this->assertEquals([], $dataProvider->provide($operation, []));
$this->assertSame([], $dataProvider->provide($operation, []));
}

public function testCannotCreateAggregationBuilder(): void
Expand All @@ -143,7 +143,7 @@ public function testCannotCreateAggregationBuilder(): void

$dataProvider = new CollectionProvider($this->resourceMetadataFactoryProphecy->reveal(), $this->managerRegistryProphecy->reveal());
$operation = (new GetCollection())->withName('foo')->withClass(ProviderDocument::class);
$this->assertEquals([], $dataProvider->provide($operation, []));
$this->assertSame([], $dataProvider->provide($operation, []));
}

public function testOperationNotFound(): void
Expand Down
2 changes: 1 addition & 1 deletion src/Doctrine/Odm/Tests/State/ItemProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ public function testAggregationResultExtension(): void

$dataProvider = new ItemProvider($this->prophesize(ResourceMetadataCollectionFactoryInterface::class)->reveal(), $managerRegistry, [$extensionProphecy->reveal()]);

$this->assertEquals($returnObject, $dataProvider->provide($operation, ['id' => 1], $context));
$this->assertSame($returnObject, $dataProvider->provide($operation, ['id' => 1], $context));
}

public function testCannotCreateAggregationBuilder(): void
Expand Down
2 changes: 1 addition & 1 deletion src/Doctrine/Orm/Tests/DoctrineOrmFilterTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ protected function doTestApply(?array $properties, array $filterParameters, stri
$queryParameter = $queryBuilder->getQuery()->getParameter($parameterName);

$this->assertNotNull($queryParameter, \sprintf('Expected query parameter "%s" to be set', $parameterName));
$this->assertEquals($expectedParameterValue, $queryParameter->getValue(), \sprintf('Expected query parameter "%s" to be "%s"', $parameterName, var_export($expectedParameterValue, true)));
$this->assertSame($expectedParameterValue, $queryParameter->getValue(), \sprintf('Expected query parameter "%s" to be "%s"', $parameterName, var_export($expectedParameterValue, true)));
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/Doctrine/Orm/Tests/Filter/BackedEnumFilterTestTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function testGetDescription(): void
'dummyBackedEnum' => null,
]);

$this->assertEquals([
$this->assertSame([
'dummyBackedEnum' => [
'property' => 'dummyBackedEnum',
'type' => 'string',
Expand Down Expand Up @@ -58,7 +58,7 @@ public function testGetDescriptionDefaultFields(): void
{
$filter = $this->buildFilter();

$this->assertEquals([
$this->assertSame([
'dummyBackedEnum' => [
'property' => 'dummyBackedEnum',
'type' => 'string',
Expand Down
Loading
Loading