Skip to content

Commit

Permalink
#11 code review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
davidhoelzel committed Apr 4, 2024
1 parent 4b3b8d4 commit 1fd8715
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions src/Component/Data/FixtureData.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
/**
* @codeCoverageIgnore
*/
class FixtureData
readonly class FixtureData
{
public function __construct(
public readonly string $className,
public string $className,
/** @param array<string, Type> $properties */
public readonly array $properties,
public readonly array $params = []
public array $properties,
public array $params = []
) {
}
}
6 changes: 3 additions & 3 deletions src/Component/Data/Generator/ScalarGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function supports(string $type, mixed $context = null): bool
'integer',
'double',
'boolean',
]);
], true);
}

public function generate(string $type, mixed $context = null): float|object|bool|int|string|null
Expand All @@ -41,8 +41,6 @@ public function generate(string $type, mixed $context = null): float|object|bool
public function createParamValue(string $type): bool|int|float|string|null
{
switch (strtolower($type)) {
default:
return null;
case 'string':
return $this->generator->text(20);
case 'int':
Expand All @@ -54,6 +52,8 @@ public function createParamValue(string $type): bool|int|float|string|null
case 'float':
case 'double':
return $this->generator->randomFloat();
default:
return null;
}
}
}
8 changes: 4 additions & 4 deletions tests/Unit/Component/ComponentItemFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ public function testValidComponent(array $componentData): void
$componentItemFactory = new ComponentItemFactory(
$validatorMock,
$categoryServiceMock,
static::createMock(Faker::class)
$this->createMock(Faker::class)
);

$item = $componentItemFactory->create($componentData);

static::assertInstanceOf(ComponentItem::class, $item);
static::assertInstanceOf(ComponentCategory::class, $item->getCategory());
$this->assertInstanceOf(ComponentItem::class, $item);
$this->assertInstanceOf(ComponentCategory::class, $item->getCategory());
}

public function testInvalidCategory(): void
Expand Down Expand Up @@ -78,7 +78,7 @@ public function testGetParamsFromVariables(): void

$result = $componentItemFactory->getParamsFromVariables($variables);

static::assertEquals([
$this->assertEquals([
'var' => [
'separated' => [
'by' => [
Expand Down

0 comments on commit 1fd8715

Please sign in to comment.