Skip to content

Commit

Permalink
test updates
Browse files Browse the repository at this point in the history
  • Loading branch information
DjordyKoert committed Oct 24, 2024
1 parent 1d87a9a commit 77bbca0
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 78 deletions.
5 changes: 0 additions & 5 deletions tests/Functional/BazingaFunctionalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

namespace Nelmio\ApiDocBundle\Tests\Functional;

use Hateoas\Configuration\Embedded;
use Metadata\Cache\PsrCacheAdapter;
use Metadata\MetadataFactory;
use Symfony\Component\Cache\Adapter\ArrayAdapter;
Expand Down Expand Up @@ -109,10 +108,6 @@ public function testWithGroup(): void

public function testWithType(): void
{
if (!method_exists(Embedded::class, 'getType')) {
self::markTestSkipped('Typed embedded properties require at most willdurand/hateoas 3.0');
}

self::assertEquals([
'type' => 'object',
'properties' => [
Expand Down
30 changes: 14 additions & 16 deletions tests/Functional/EntityExcluded/BazingaUserTyped.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,20 @@

use Hateoas\Configuration\Annotation as Hateoas;

/**
* @Hateoas\Relation(
* name="typed_bazinga_users",
* embedded=@Hateoas\Embedded(
* "expr(service('zz'))",
* type="array<Nelmio\ApiDocBundle\Tests\Functional\Entity\BazingaUser>"
* )
* )
* @Hateoas\Relation(
* name="typed_bazinga_name",
* embedded=@Hateoas\Embedded(
* "expr(service('yy'))",
* type="string"
* )
* )
*/
#[Hateoas\Relation(
name: 'typed_bazinga_users',
embedded: new Hateoas\Embedded(
content: "expr(service('zz'))",
type: "array<Nelmio\ApiDocBundle\Tests\Functional\Entity\BazingaUser>"
)
)]
#[Hateoas\Relation(
name: 'typed_bazinga_name',
embedded: new Hateoas\Embedded(
content: "expr(service('yy'))",
type: 'string'
)
)]
class BazingaUserTyped
{
}
36 changes: 0 additions & 36 deletions tests/Functional/EntityExcluded/SerializedNameEnt.php

This file was deleted.

11 changes: 1 addition & 10 deletions tests/Functional/FunctionalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
use OpenApi\Attributes as OAAttributes;
use OpenApi\Generator;
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Serializer\Annotation\SerializedName;

class FunctionalTest extends WebTestCase
{
Expand Down Expand Up @@ -587,15 +586,7 @@ public function testNoDuplicatedParameters(): void

public function testSerializedNameAction(): void
{
if (!class_exists(SerializedName::class)) {
self::markTestSkipped('Annotation @SerializedName doesn\'t exist.');
}

if (TestKernel::isAttributesAvailable()) {
$model = $this->getModel('SerializedNameEntity');
} else {
$model = $this->getModel('SerializedNameEnt');
}
$model = $this->getModel('SerializedNameEntity');

self::assertCount(2, $model->properties);

Expand Down
7 changes: 0 additions & 7 deletions tests/Functional/TestKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
use ApiPlatform\Symfony\Bundle\ApiPlatformBundle;
use Bazinga\Bundle\HateoasBundle\BazingaHateoasBundle;
use FOS\RestBundle\FOSRestBundle;
use Hateoas\Configuration\Embedded;
use JMS\SerializerBundle\JMSSerializerBundle;
use Nelmio\ApiDocBundle\NelmioApiDocBundle;
use Nelmio\ApiDocBundle\Render\Html\AssetsMode;
Expand Down Expand Up @@ -91,12 +90,6 @@ protected function configureRoutes(RoutingConfigurator $routes): void

if (self::USE_BAZINGA === $this->flag) {
$routes->withPath('/')->import(__DIR__.'/Controller/BazingaTypedController.php', self::isAnnotationsAvailable() ? 'annotation' : 'attribute');

try {
new \ReflectionMethod(Embedded::class, 'getType');
$routes->withPath('/')->import(__DIR__.'/Controller/BazingaTypedController.php', self::isAnnotationsAvailable() ? 'annotation' : 'attribute');
} catch (\ReflectionException $e) {
}
}

if (self::USE_FOSREST === $this->flag) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,6 @@ public function testUpdatePropertyFix1283(): void
*/
public function testOptionalProperty($entity): void
{
if (!\property_exists(Assert\NotBlank::class, 'allowNull')) {
self::markTestSkipped('NotBlank::allowNull was added in symfony/validator 4.3.');
}

$schema = $this->createObj(OA\Schema::class, []);
$schema->merge([$this->createObj(OA\Property::class, ['property' => 'property1'])]);
$schema->merge([$this->createObj(OA\Property::class, ['property' => 'property2'])]);
Expand Down

0 comments on commit 77bbca0

Please sign in to comment.