Skip to content

Commit a99eabc

Browse files
committed
Fix PHPUnit tests
1 parent a367183 commit a99eabc

File tree

14 files changed

+28
-40
lines changed

14 files changed

+28
-40
lines changed

phpstan.neon

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,4 @@ parameters:
1212
# False positives
1313
- '#Parameter \#2 \$dqlPart of method Doctrine\\ORM\\QueryBuilder::add\(\) expects Doctrine\\ORM\\Query\\Expr\\Base, Doctrine\\ORM\\Query\\Expr\\Join\[\] given#' # Fixed in Doctrine's master
1414
- '#Call to an undefined method Doctrine\\Common\\Persistence\\ObjectManager::getConnection\(\)#'
15-
- '#Parameter \#1 \$callable of static method Doctrine\\Common\\Annotations\\AnnotationRegistry::registerLoader\(\) expects callable, mixed\[\] given#'
1615
- '#Class Symfony\\Component\\ExpressionLanguage\\ExpressionLanguage not found and could not be autoloaded#'

tests/Bridge/Doctrine/Orm/Extension/EagerLoadingExtensionTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -542,8 +542,6 @@ public function testApplyToCollectionNoPartial()
542542

543543
$propertyNameCollectionFactoryProphecy = $this->prophesize(PropertyNameCollectionFactoryInterface::class);
544544

545-
$relatedNameCollection = new PropertyNameCollection(['id', 'name', 'notindatabase', 'notreadable']);
546-
547545
$propertyMetadataFactoryProphecy = $this->prophesize(PropertyMetadataFactoryInterface::class);
548546
$relationPropertyMetadata = new PropertyMetadata();
549547
$relationPropertyMetadata = $relationPropertyMetadata->withReadableLink(true);

tests/Bridge/Doctrine/Orm/Extension/FilterEagerLoadingExtensionTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
use ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\CompositeLabel;
2222
use ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\CompositeRelation;
2323
use ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\DummyCar;
24-
use ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\Foo;
2524
use Doctrine\ORM\EntityManager;
2625
use Doctrine\ORM\Mapping\ClassMetadataInfo;
2726
use Doctrine\ORM\Query\Expr;

tests/Bridge/Symfony/Bundle/DependencyInjection/ApiPlatformExtensionTest.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
use Symfony\Component\Config\Resource\ResourceInterface;
2525
use Symfony\Component\DependencyInjection\ContainerBuilder;
2626
use Symfony\Component\DependencyInjection\Definition;
27-
use Symfony\Component\DependencyInjection\DefinitionDecorator;
2827
use Symfony\Component\DependencyInjection\Extension\ConfigurationExtensionInterface;
2928
use Symfony\Component\DependencyInjection\Extension\ExtensionInterface;
3029
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
@@ -201,10 +200,6 @@ public function testDisableEagerLoadingExtension()
201200

202201
private function getContainerBuilderProphecy()
203202
{
204-
$definitionArgument = Argument::that(function ($argument) {
205-
return $argument instanceof Definition || $argument instanceof DefinitionDecorator;
206-
});
207-
208203
$containerBuilderProphecy = $this->prophesize(ContainerBuilder::class);
209204
$containerBuilderProphecy->getParameter('kernel.bundles')->willReturn([
210205
'DoctrineBundle' => DoctrineBundle::class,
@@ -368,7 +363,7 @@ private function getContainerBuilderProphecy()
368363
];
369364

370365
foreach ($definitions as $definition) {
371-
$containerBuilderProphecy->setDefinition($definition, $definitionArgument)->shouldBeCalled();
366+
$containerBuilderProphecy->setDefinition($definition, Argument::type(Definition::class))->shouldBeCalled();
372367
}
373368

374369
$aliases = [

tests/Fixtures/TestBundle/Entity/CompositeItem.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public function getId()
5757
/**
5858
* Gets field1.
5959
*
60-
* @return string
60+
* @return string|null
6161
*/
6262
public function getField1()
6363
{
@@ -67,9 +67,9 @@ public function getField1()
6767
/**
6868
* Sets field1.
6969
*
70-
* @param string the value to set
70+
* @param string|null $field1 the value to set
7171
*/
72-
public function setField1($field1)
72+
public function setField1($field1 = null)
7373
{
7474
$this->field1 = $field1;
7575
}

tests/Fixtures/TestBundle/Entity/CompositeLabel.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function getId()
5151
/**
5252
* Gets value.
5353
*
54-
* @return string
54+
* @return string|null
5555
*/
5656
public function getValue()
5757
{
@@ -61,9 +61,9 @@ public function getValue()
6161
/**
6262
* Sets value.
6363
*
64-
* @param string the value to set
64+
* @param string|null $value the value to set
6565
*/
66-
public function setValue($value)
66+
public function setValue($value = null)
6767
{
6868
$this->value = $value;
6969
}

tests/Fixtures/TestBundle/Entity/CompositeRelation.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class CompositeRelation
5050
/**
5151
* Gets value.
5252
*
53-
* @return string
53+
* @return string|null
5454
*/
5555
public function getValue()
5656
{
@@ -60,9 +60,9 @@ public function getValue()
6060
/**
6161
* Sets value.
6262
*
63-
* @param string the value to set
63+
* @param string|null $value the value to set
6464
*/
65-
public function setValue($value)
65+
public function setValue($value = null)
6666
{
6767
$this->value = $value;
6868
}
@@ -80,9 +80,9 @@ public function getCompositeItem()
8080
/**
8181
* Sets compositeItem.
8282
*
83-
* @param CompositeItem the value to set
83+
* @param CompositeItem $compositeItem the value to set
8484
*/
85-
public function setCompositeItem($compositeItem)
85+
public function setCompositeItem(CompositeItem $compositeItem)
8686
{
8787
$this->compositeItem = $compositeItem;
8888
}
@@ -100,9 +100,9 @@ public function getCompositeLabel()
100100
/**
101101
* Sets compositeLabel.
102102
*
103-
* @param CompositeLabel the value to set
103+
* @param CompositeLabel $compositeLabel the value to set
104104
*/
105-
public function setCompositeLabel($compositeLabel)
105+
public function setCompositeLabel(CompositeLabel $compositeLabel)
106106
{
107107
$this->compositeLabel = $compositeLabel;
108108
}

tests/Fixtures/TestBundle/Entity/DummyFriend.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public function getId()
6161
/**
6262
* Set id.
6363
*
64-
* @param id the value to set
64+
* @param int $id the value to set
6565
*/
6666
public function setId($id)
6767
{
@@ -81,7 +81,7 @@ public function getName()
8181
/**
8282
* Set name.
8383
*
84-
* @param string the value to set
84+
* @param string $name the value to set
8585
*/
8686
public function setName($name)
8787
{

tests/Fixtures/TestBundle/Entity/RelatedDummy.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ public function setDummyBoolean($dummyBoolean)
139139
/**
140140
* Get relatedToDummyFriend.
141141
*
142-
* @return RelatedToDummyFriend
142+
* @return RelatedToDummyFriend[]
143143
*/
144144
public function getRelatedToDummyFriend()
145145
{
@@ -149,7 +149,7 @@ public function getRelatedToDummyFriend()
149149
/**
150150
* Set relatedToDummyFriend.
151151
*
152-
* @param RelatedToDummyFriend the value to set
152+
* @param RelatedToDummyFriend $relatedToDummyFriend the value to set
153153
*/
154154
public function addRelatedToDummyFriend(RelatedToDummyFriend $relatedToDummyFriend)
155155
{

tests/Fixtures/app/bootstrap.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@
1818
$loader = require __DIR__.'/../../../vendor/autoload.php';
1919
require __DIR__.'/AppKernel.php';
2020

21-
AnnotationRegistry::registerLoader([$loader, 'loadClass']);
21+
AnnotationRegistry::registerLoader('class_exists');
2222

2323
return $loader;

0 commit comments

Comments
 (0)