Skip to content

Commit

Permalink
prepare release
Browse files Browse the repository at this point in the history
  • Loading branch information
spiralbot committed Jan 7, 2025
1 parent 50d7b2e commit f16cbb1
Show file tree
Hide file tree
Showing 36 changed files with 312 additions and 129 deletions.
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@
"php": ">=8.1",
"psr/http-message": "^1.0|^2.0",
"spiral/attributes": "^2.8|^3.0",
"spiral/auth": "^3.15",
"spiral/core": "^3.15",
"spiral/hmvc": "^3.15",
"spiral/models": "^3.15",
"spiral/validation": "^3.15"
"spiral/auth": "^3.14.9",
"spiral/core": "^3.14.9",
"spiral/hmvc": "^3.14.9",
"spiral/models": "^3.14.9",
"spiral/validation": "^3.14.9"
},
"require-dev": {
"mockery/mockery": "^1.5",
Expand Down
4 changes: 2 additions & 2 deletions tests/Config/FiltersConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ public function testGetsInterceptors(): void
'interceptors' => $array = ['foo', 'bar'],
]);

self::assertSame($array, $config->getInterceptors());
$this->assertSame($array, $config->getInterceptors());
}

public function testGetsInterceptorsWhenKeyIsNotDefined(): void
{
$config = new FiltersConfig([]);

self::assertSame([], $config->getInterceptors());
$this->assertSame([], $config->getInterceptors());
}
}
18 changes: 9 additions & 9 deletions tests/InputScopeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,36 +32,36 @@ public function setUp(): void
public function testGetValue(): void
{
$input = $this->getInput();
self::assertSame('value', $input->getValue('data', 'foo'));
self::assertNull($input->getValue('data', 'bar.empty'));
$this->assertSame('value', $input->getValue('data', 'foo'));
$this->assertNull($input->getValue('data', 'bar.empty'));
}

public function testGetValueWithNonExistingKey(): void
{
$input = $this->getInput();
self::assertNull($input->getValue('data', 'invalid_key'));
$this->assertNull($input->getValue('data', 'invalid_key'));
}

public function testHasValue(): void
{
$input = $this->getInput();
self::assertFalse($input->hasValue('data', 'invalid_key'));
self::assertTrue($input->hasValue('data', 'foo'));
self::assertTrue($input->hasValue('data', 'bar'));
$this->assertFalse($input->hasValue('data', 'invalid_key'));
$this->assertTrue($input->hasValue('data', 'foo'));
$this->assertTrue($input->hasValue('data', 'bar'));
}

public function testHasValueNested(): void
{
$input = $this->getInput();

self::assertTrue($input->hasValue('data', 'bar.empty'));
self::assertFalse($input->hasValue('data', 'bar.empty.invalid_key'));
$this->assertTrue($input->hasValue('data', 'bar.empty'));
$this->assertFalse($input->hasValue('data', 'bar.empty.invalid_key'));
}

public function testHasValueWithNonExistingSource(): void
{
$input = $this->getInput();
self::assertFalse($input->hasValue('query', 'foo'));
$this->assertFalse($input->hasValue('query', 'foo'));
}

private function getInput(): InputInterface
Expand Down
8 changes: 4 additions & 4 deletions tests/Mapper/CasterRegistryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@ final class CasterRegistryTest extends TestCase
public function testRegisterAndGetCasters(): void
{
$registry = new CasterRegistry();
self::assertCount(0, $registry->getCasters());
$this->assertCount(0, $registry->getCasters());

$setter = $this->createMock(CasterInterface::class);
$registry->register($setter);
self::assertCount(1, $registry->getCasters());
self::assertSame([$setter], $registry->getCasters());
$this->assertCount(1, $registry->getCasters());
$this->assertSame([$setter], $registry->getCasters());
}

public function testGetDefault(): void
{
$registry = new CasterRegistry();
self::assertInstanceOf(DefaultCaster::class, $registry->getDefault());
$this->assertInstanceOf(DefaultCaster::class, $registry->getDefault());
}
}
4 changes: 2 additions & 2 deletions tests/Mapper/DefaultCasterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ final class DefaultCasterTest extends TestCase
{
public function testSupports(): void
{
self::assertTrue((new DefaultCaster())->supports($this->createMock(\ReflectionNamedType::class)));
$this->assertTrue((new DefaultCaster())->supports($this->createMock(\ReflectionNamedType::class)));
}

public function testSetValue(): void
Expand All @@ -23,7 +23,7 @@ public function testSetValue(): void
$property = new \ReflectionProperty($filter, 'city');

$setter->setValue($filter, $property, 'foo');
self::assertSame('foo', $property->getValue($filter));
$this->assertSame('foo', $property->getValue($filter));
}

public function testSetValueException(): void
Expand Down
4 changes: 2 additions & 2 deletions tests/Mapper/EnumCasterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ final class EnumCasterTest extends TestCase
#[DataProvider('supportsDataProvider')]
public function testSupports(\ReflectionProperty $ref, bool $expected): void
{
self::assertSame($expected, (new EnumCaster())->supports($ref->getType()));
$this->assertSame($expected, (new EnumCaster())->supports($ref->getType()));
}

public function testSetValue(): void
Expand All @@ -26,7 +26,7 @@ public function testSetValue(): void
$property = new \ReflectionProperty($filter, 'status');

$setter->setValue($filter, $property, 'active');
self::assertEquals(Status::Active, $property->getValue($filter));
$this->assertEquals(Status::Active, $property->getValue($filter));
}

public function testSetValueException(): void
Expand Down
4 changes: 2 additions & 2 deletions tests/Mapper/UuidCasterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ final class UuidCasterTest extends TestCase
#[DataProvider('supportsDataProvider')]
public function testSupports(\ReflectionProperty $ref, bool $expected): void
{
self::assertSame($expected, (new UuidCaster())->supports($ref->getType()));
$this->assertSame($expected, (new UuidCaster())->supports($ref->getType()));
}

public function testSetValue(): void
Expand All @@ -25,7 +25,7 @@ public function testSetValue(): void
$property = new \ReflectionProperty($filter, 'groupUuid');

$setter->setValue($filter, $property, '11111111-1111-1111-1111-111111111111');
self::assertSame('11111111-1111-1111-1111-111111111111', $property->getValue($filter)->toString());
$this->assertSame('11111111-1111-1111-1111-111111111111', $property->getValue($filter)->toString());
}

public function testSetValueException(): void
Expand Down
20 changes: 16 additions & 4 deletions tests/Model/Attribute/Input/AttributeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,20 @@ public function testGetsValueForDefinedKey(): void
->with('attribute', 'foo')
->andReturn('bar');

self::assertSame('bar', $attribute->getValue($this->input, $this->makeProperty()));
$this->assertSame(
'bar',
$attribute->getValue($this->input, $this->makeProperty())
);
}

public function testGetsSchemaForDefinedKey(): void
{
$attribute = new Attribute('foo');

self::assertSame('attribute:foo', $attribute->getSchema($this->makeProperty()));
$this->assertSame(
'attribute:foo',
$attribute->getSchema($this->makeProperty())
);
}

public function testGetsValueForNotDefinedKey(): void
Expand All @@ -38,13 +44,19 @@ public function testGetsValueForNotDefinedKey(): void
->with('attribute', 'baz')
->andReturn('bar');

self::assertSame('bar', $attribute->getValue($this->input, $this->makeProperty()));
$this->assertSame(
'bar',
$attribute->getValue($this->input, $this->makeProperty())
);
}

public function testGetsSchemaForNotDefinedKey(): void
{
$attribute = new Attribute();

self::assertSame('attribute:baz', $attribute->getSchema($this->makeProperty()));
$this->assertSame(
'attribute:baz',
$attribute->getSchema($this->makeProperty())
);
}
}
10 changes: 8 additions & 2 deletions tests/Model/Attribute/Input/BearerTokenTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,19 @@ public function testGetsValue(): void
->with('bearerToken')
->andReturn('bar');

self::assertSame('bar', $attribute->getValue($this->input, $this->makeProperty()));
$this->assertSame(
'bar',
$attribute->getValue($this->input, $this->makeProperty())
);
}

public function testGetsSchema(): void
{
$attribute = new BearerToken();

self::assertSame('bearerToken', $attribute->getSchema($this->makeProperty()));
$this->assertSame(
'bearerToken',
$attribute->getSchema($this->makeProperty())
);
}
}
20 changes: 16 additions & 4 deletions tests/Model/Attribute/Input/CookieTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,20 @@ public function testGetsValueForDefinedKey(): void
->with('cookie', 'foo')
->andReturn('bar');

self::assertSame('bar', $attribute->getValue($this->input, $this->makeProperty()));
$this->assertSame(
'bar',
$attribute->getValue($this->input, $this->makeProperty())
);
}

public function testGetsSchemaForDefinedKey(): void
{
$attribute = new Cookie('foo');

self::assertSame('cookie:foo', $attribute->getSchema($this->makeProperty()));
$this->assertSame(
'cookie:foo',
$attribute->getSchema($this->makeProperty())
);
}

public function testGetsValueForNotDefinedKey(): void
Expand All @@ -38,13 +44,19 @@ public function testGetsValueForNotDefinedKey(): void
->with('cookie', 'baz')
->andReturn('bar');

self::assertSame('bar', $attribute->getValue($this->input, $this->makeProperty()));
$this->assertSame(
'bar',
$attribute->getValue($this->input, $this->makeProperty())
);
}

public function testGetsSchemaForNotDefinedKey(): void
{
$attribute = new Cookie();

self::assertSame('cookie:baz', $attribute->getSchema($this->makeProperty()));
$this->assertSame(
'cookie:baz',
$attribute->getSchema($this->makeProperty())
);
}
}
20 changes: 16 additions & 4 deletions tests/Model/Attribute/Input/DataTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,20 @@ public function testGetsValueForDefinedKey(): void
->with('data', 'foo')
->andReturn('bar');

self::assertSame('bar', $attribute->getValue($this->input, $this->makeProperty()));
$this->assertSame(
'bar',
$attribute->getValue($this->input, $this->makeProperty())
);
}

public function testGetsSchemaForDefinedKey(): void
{
$attribute = new Data('foo');

self::assertSame('data:foo', $attribute->getSchema($this->makeProperty()));
$this->assertSame(
'data:foo',
$attribute->getSchema($this->makeProperty())
);
}

public function testGetsValueForNotDefinedKey(): void
Expand All @@ -38,13 +44,19 @@ public function testGetsValueForNotDefinedKey(): void
->with('data', 'baz')
->andReturn('bar');

self::assertSame('bar', $attribute->getValue($this->input, $this->makeProperty()));
$this->assertSame(
'bar',
$attribute->getValue($this->input, $this->makeProperty())
);
}

public function testGetsSchemaForNotDefinedKey(): void
{
$attribute = new Data();

self::assertSame('data:baz', $attribute->getSchema($this->makeProperty()));
$this->assertSame(
'data:baz',
$attribute->getSchema($this->makeProperty())
);
}
}
20 changes: 16 additions & 4 deletions tests/Model/Attribute/Input/FileTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,20 @@ public function testGetsValueForDefinedKey(): void
->with('file', 'foo')
->andReturn($file = m::mock(UploadedFileInterface::class));

self::assertSame($file, $attribute->getValue($this->input, $this->makeProperty()));
$this->assertSame(
$file,
$attribute->getValue($this->input, $this->makeProperty())
);
}

public function testGetsSchemaForDefinedKey(): void
{
$attribute = new File('foo');

self::assertSame('file:foo', $attribute->getSchema($this->makeProperty()));
$this->assertSame(
'file:foo',
$attribute->getSchema($this->makeProperty())
);
}

public function testGetsValueForNotDefinedKey(): void
Expand All @@ -40,13 +46,19 @@ public function testGetsValueForNotDefinedKey(): void
->with('file', 'baz')
->andReturn($file = m::mock(UploadedFileInterface::class));

self::assertSame($file, $attribute->getValue($this->input, $this->makeProperty()));
$this->assertSame(
$file,
$attribute->getValue($this->input, $this->makeProperty())
);
}

public function testGetsSchemaForNotDefinedKey(): void
{
$attribute = new File();

self::assertSame('file:baz', $attribute->getSchema($this->makeProperty()));
$this->assertSame(
'file:baz',
$attribute->getSchema($this->makeProperty())
);
}
}
Loading

0 comments on commit f16cbb1

Please sign in to comment.