Skip to content
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
6 changes: 1 addition & 5 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,7 @@

<filter>
<whitelist>
<directory>.</directory>
<exclude>
<directory>tests</directory>
<directory>vendor</directory>
</exclude>
<directory>src</directory>
</whitelist>
</filter>
</phpunit>
Original file line number Diff line number Diff line change
Expand Up @@ -59,23 +59,23 @@ protected function setUp(): void
);
}

public function testGenerateClassAnnotations()
public function testGenerateClassAnnotations(): void
{
$this->assertSame(['@ApiResource(iri="http://schema.org/Res")'], $this->generator->generateClassAnnotations('Res'));
}

public function testGenerateClassAnnotationsWithOperations()
public function testGenerateClassAnnotationsWithOperations(): void
{
$this->assertSame(['@ApiResource(iri="http://schema.org/WithOperations", itemOperations={"get"={"route_name"="api_about_get"}}, collectionOperations={})'], $this->generator->generateClassAnnotations('WithOperations'));
}

public function testGenerateFieldAnnotations()
public function testGenerateFieldAnnotations(): void
{
$this->assertSame(['@ApiProperty(iri="http://schema.org/prop")'], $this->generator->generateFieldAnnotations('Res', 'prop'));
$this->assertSame([], $this->generator->generateFieldAnnotations('Res', 'customProp'));
}

public function testGenerateUses()
public function testGenerateUses(): void
{
$this->assertSame(['ApiPlatform\Core\Annotation\ApiResource', 'ApiPlatform\Core\Annotation\ApiProperty'], $this->generator->generateUses('Res'));
$this->assertSame([], $this->generator->generateUses('MyEnum'));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class DoctrineOrmAnnotationGeneratorTest extends TestCase
*/
private $generator;

public function setUp()
protected function setUp(): void
{
$graph = new \EasyRdf_Graph();
$myEnum = new \EasyRdf_Resource('https://schema.org/MyEnum', $graph);
Expand Down Expand Up @@ -79,15 +79,15 @@ public function setUp()
);
}

public function testGenerateClassAnnotations()
public function testGenerateClassAnnotations(): void
{
$this->assertSame([], $this->generator->generateClassAnnotations('MyEnum'));
$this->assertSame(['', '@ORM\MappedSuperclass'], $this->generator->generateClassAnnotations('Product'));
$this->assertSame(['', '@ORM\Entity'], $this->generator->generateClassAnnotations('Vehicle'));
$this->assertSame(['', '@ORM\Embeddable'], $this->generator->generateClassAnnotations('QuantitativeValue'));
}

public function testGenerateFieldAnnotations()
public function testGenerateFieldAnnotations(): void
{
$this->assertSame(
['@ORM\Embedded(class="QuantitativeValue", columnPrefix=false)'],
Expand Down
2 changes: 1 addition & 1 deletion tests/Command/DumpConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
*/
class DumpConfigurationTest extends TestCase
{
public function testDumpConfiguration()
public function testDumpConfiguration(): void
{
$commandTester = new CommandTester(new DumpConfigurationCommand());
$this->assertEquals(0, $commandTester->execute([]));
Expand Down
2 changes: 1 addition & 1 deletion tests/Command/ExtractCardinalitiesCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
*/
class ExtractCardinalitiesCommandTest extends TestCase
{
public function testExtractCardinalities()
public function testExtractCardinalities(): void
{
$commandTester = new CommandTester(new ExtractCardinalitiesCommand());
$this->assertEquals(0, $commandTester->execute(
Expand Down
32 changes: 16 additions & 16 deletions tests/Command/GenerateTypesCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ protected function setUp(): void
/**
* @dataProvider getArguments
*/
public function testCommand($output, $config)
public function testCommand($output, $config): void
{
$this->fs->mkdir($output);

$commandTester = new CommandTester(new GenerateTypesCommand());
$this->assertEquals(0, $commandTester->execute(['output' => $output, 'config' => $config]));
}

public function getArguments()
public function getArguments(): array
{
return [
[__DIR__.'/../../build/blog/', __DIR__.'/../config/blog.yaml'],
Expand All @@ -55,7 +55,7 @@ public function getArguments()
];
}

public function testDoctrineCollection()
public function testDoctrineCollection(): void
{
$outputDir = __DIR__.'/../../build/address-book';
$config = __DIR__.'/../config/address-book.yaml';
Expand All @@ -78,7 +78,7 @@ public function getFriends(): Collection
, $person);
}

public function testFluentMutators()
public function testFluentMutators(): void
{
$outputDir = __DIR__.'/../../build/fluent-mutators';
$config = __DIR__.'/../config/fluent-mutators.yaml';
Expand Down Expand Up @@ -115,7 +115,7 @@ public function removeFriend(Person $friend): self
, $person);
}

public function testDoNotGenerateAccessorMethods()
public function testDoNotGenerateAccessorMethods(): void
{
$outputDir = __DIR__.'/../../build/public-properties';
$config = __DIR__.'/../config/public-properties.yaml';
Expand All @@ -132,7 +132,7 @@ public function testDoNotGenerateAccessorMethods()
$this->assertNotContains('function remove', $person);
}

public function testImplicitAndExplicitPropertyInheritance()
public function testImplicitAndExplicitPropertyInheritance(): void
{
$outputDir = __DIR__.'/../../build/inherited-properties';
$config = __DIR__.'/../config/inherited-properties.yaml';
Expand Down Expand Up @@ -164,7 +164,7 @@ public function testImplicitAndExplicitPropertyInheritance()
$this->assertNotContains('function setName(', $webPage);
}

public function testReadableWritable()
public function testReadableWritable(): void
{
$outputDir = __DIR__.'/../../build/readable-writable';
$config = __DIR__.'/../config/readable-writable.yaml';
Expand All @@ -184,7 +184,7 @@ public function testReadableWritable()
$this->assertNotContains('function removeFriend(', $person);
}

public function testGeneratedId()
public function testGeneratedId(): void
{
$outputDir = __DIR__.'/../../build/generated-id';
$config = __DIR__.'/../config/generated-id.yaml';
Expand Down Expand Up @@ -219,7 +219,7 @@ public function getId(): ?int
$this->assertNotContains('function setId(', $person);
}

public function testNonGeneratedId()
public function testNonGeneratedId(): void
{
$outputDir = __DIR__.'/../../build/non-generated-id';
$config = __DIR__.'/../config/non-generated-id.yaml';
Expand Down Expand Up @@ -253,7 +253,7 @@ public function getId(): string
$this->assertContains('public function setId(string $id): void', $person);
}

public function testGeneratedUuid()
public function testGeneratedUuid(): void
{
$outputDir = __DIR__.'/../../build/generated-uuid';
$config = __DIR__.'/../config/generated-uuid.yaml';
Expand Down Expand Up @@ -289,7 +289,7 @@ public function getId(): ?string
$this->assertNotContains('function setId(', $person);
}

public function testNonGeneratedUuid()
public function testNonGeneratedUuid(): void
{
$outputDir = __DIR__.'/../../build/non-generated-uuid';
$config = __DIR__.'/../config/non-generated-uuid.yaml';
Expand Down Expand Up @@ -324,7 +324,7 @@ public function getId(): string
$this->assertContains('public function setId(string $id): void', $person);
}

public function testDoNotGenerateId()
public function testDoNotGenerateId(): void
{
$outputDir = __DIR__.'/../../build/no-id';
$config = __DIR__.'/../config/no-id.yaml';
Expand All @@ -341,7 +341,7 @@ public function testDoNotGenerateId()
$this->assertNotContains('function setId', $person);
}

public function testNamespacesPrefix()
public function testNamespacesPrefix(): void
{
$outputDir = __DIR__.'/../../build/namespaces-prefix';
$config = __DIR__.'/../config/namespaces-prefix.yaml';
Expand All @@ -356,7 +356,7 @@ public function testNamespacesPrefix()
$this->assertContains('namespace App\Entity;', $person);
}

public function testNamespacesPrefixAutodetect()
public function testNamespacesPrefixAutodetect(): void
{
$outputDir = __DIR__.'/../../build/namespaces-prefix-autodetect/';

Expand All @@ -378,7 +378,7 @@ public function testNamespacesPrefixAutodetect()
}
}

public function testGeneratedEnum()
public function testGeneratedEnum(): void
{
$outputDir = __DIR__.'/../../build/enum';
$config = __DIR__.'/../config/enum.yaml';
Expand All @@ -401,7 +401,7 @@ public function testGeneratedEnum()
$this->assertNotContains('function setId(', $gender);
}

public function testSupersededProperties()
public function testSupersededProperties(): void
{
$outputDir = __DIR__.'/../../build/superseded-properties';
$config = __DIR__.'/../config/superseded-properties.yaml';
Expand Down
2 changes: 1 addition & 1 deletion tests/TypesGeneratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ private function getClasses(): array
*
* @return \Closure
*/
private function getContextMatcher(array $class)
private function getContextMatcher(array $class): \Closure
{
$config = $this->getConfig();

Expand Down