Skip to content

Commit cbab536

Browse files
committed
mongodb: fix tests
1 parent 8e48be8 commit cbab536

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

src/Core/Bridge/Doctrine/MongoDbOdm/ItemDataProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ public function getItem(string $resourceClass, $id, string $operationName = null
119119
} else {
120120
/** @var ResourceMetadata */
121121
$resourceMetadata = $this->resourceMetadataFactory->create($resourceClass);
122-
$attribute = $resourceMetadata->getSubresourceOperationAttribute($operationName, 'doctrine_mongodb', [], true);
122+
$attribute = $resourceMetadata->getItemOperationAttribute($operationName, 'doctrine_mongodb', [], true);
123123
}
124124

125125
$executeOptions = $attribute['execute_options'] ?? [];

tests/Core/Bridge/Doctrine/MongoDbOdm/ItemDataProviderTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,8 @@ public function testGetItemDoubleIdentifier()
171171
public function testGetItemWrongCompositeIdentifier()
172172
{
173173
$this->expectException(PropertyNotFoundException::class);
174+
$resourceMetadataFactoryProphecy = $this->prophesize(ResourceMetadataFactoryInterface::class);
175+
$resourceMetadataFactoryProphecy->create(Dummy::class)->willReturn(new ResourceMetadata());
174176

175177
[$propertyNameCollectionFactory, $propertyMetadataFactory] = $this->getMetadataFactories(Dummy::class, [
176178
'ida',
@@ -185,7 +187,7 @@ public function testGetItemWrongCompositeIdentifier()
185187
],
186188
]);
187189

188-
$dataProvider = new ItemDataProvider($managerRegistry, $this->resourceMetadataFactoryProphecy->reveal(), $propertyNameCollectionFactory, $propertyMetadataFactory);
190+
$dataProvider = new ItemDataProvider($managerRegistry, $resourceMetadataFactoryProphecy->reveal(), $propertyNameCollectionFactory, $propertyMetadataFactory);
189191
$dataProvider->getItem(Dummy::class, 'ida=1;', 'foo');
190192
}
191193

tests/Doctrine/Odm/Metadata/Property/DoctrineMongoDbOdmPropertyMetadataFactoryTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313

1414
namespace ApiPlatform\Tests\Doctrine\Odm\Metadata\Property;
1515

16-
use ApiPlatform\Core\Metadata\Property\Factory\PropertyMetadataFactoryInterface;
1716
use ApiPlatform\Core\Tests\ProphecyTrait;
1817
use ApiPlatform\Doctrine\Odm\Metadata\Property\DoctrineMongoDbOdmPropertyMetadataFactory;
1918
use ApiPlatform\Metadata\ApiProperty;
19+
use ApiPlatform\Metadata\Property\Factory\PropertyMetadataFactoryInterface;
2020
use ApiPlatform\Tests\Fixtures\TestBundle\Document\Dummy;
2121
use Doctrine\ODM\MongoDB\DocumentManager;
2222
use Doctrine\ODM\MongoDB\Mapping\ClassMetadata;

0 commit comments

Comments
 (0)