Skip to content

Commit

Permalink
prepare release
Browse files Browse the repository at this point in the history
  • Loading branch information
spiralbot committed Jan 22, 2025
1 parent f6c09b7 commit 620a016
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 36 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@
"require": {
"php": ">=8.1",
"spiral/attributes": "^2.8|^3.0",
"spiral/tokenizer": "^3.15",
"spiral/tokenizer": "^3.14.10",
"psr/event-dispatcher": "^1.0"
},
"require-dev": {
"spiral/boot": "^3.15",
"spiral/boot": "^3.14.10",
"phpunit/phpunit": "^10.1",
"mockery/mockery": "^1.5",
"vimeo/psalm": "^5.9"
Expand Down
10 changes: 5 additions & 5 deletions tests/AutowireListenerFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function testCreateListenerForClass(): void

$this->listener->shouldReceive('onFooEvent')->once()->with($this->ev);

ContainerScope::runScope($this->container, function (): void {
ContainerScope::runScope($this->container, function () {
$listener = $this->factory->create(ClassAndMethodAttribute::class, 'onFooEvent');
$listener($this->ev);
});
Expand All @@ -54,7 +54,7 @@ public function testCreateListenerForObject(): void
{
$this->listener->shouldReceive('onFooEvent')->once()->with($this->ev);

ContainerScope::runScope($this->container, function (): void {
ContainerScope::runScope($this->container, function () {
$listener = $this->factory->create($this->listener, 'onFooEvent');
$listener($this->ev);
});
Expand All @@ -76,7 +76,7 @@ public function testCreateAutowiredListenerForClass(): void
->once()
->with([$this->listener, 'onFooEventWithTwoArguments'], ['event' => $this->ev]);

ContainerScope::runScope($this->container, function (): void {
ContainerScope::runScope($this->container, function () {
$listener = $this->factory->create(ClassAndMethodAttribute::class, 'onFooEventWithTwoArguments');
$listener($this->ev);
});
Expand All @@ -93,7 +93,7 @@ public function testCreateAutowiredListenerForObject(): void
->once()
->with([$this->listener, 'onFooEventWithTwoArguments'], ['event' => $this->ev]);

ContainerScope::runScope($this->container, function (): void {
ContainerScope::runScope($this->container, function () {
$listener = $this->factory->create($this->listener, 'onFooEventWithTwoArguments');
$listener($this->ev);
});
Expand All @@ -106,7 +106,7 @@ public function testListenerWithoutMethodShouldThrowAnException(): void
'Listener `Spiral\Tests\Events\Fixtures\Listener\ClassAndMethodAttribute` does not contain `test` method.'
);

ContainerScope::runScope($this->container, function (): void {
ContainerScope::runScope($this->container, function () {
$this->factory->create(ClassAndMethodAttribute::class, 'test');
});
}
Expand Down
18 changes: 9 additions & 9 deletions tests/Config/EventListenerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,26 @@ public function testDefaultMethod(): void
{
$dto = new EventListener('foo');

self::assertSame('foo', $dto->listener);
self::assertSame('__invoke', $dto->method);
self::assertSame(0, $dto->priority);
$this->assertSame('foo', $dto->listener);
$this->assertSame('__invoke', $dto->method);
$this->assertSame(0, $dto->priority);
}

public function testMethod(): void
{
$dto = new EventListener('foo', method: 'bar');

self::assertSame('foo', $dto->listener);
self::assertSame('bar', $dto->method);
self::assertSame(0, $dto->priority);
$this->assertSame('foo', $dto->listener);
$this->assertSame('bar', $dto->method);
$this->assertSame(0, $dto->priority);
}

public function testPriority(): void
{
$dto = new EventListener('foo', method: 'bar', priority: 10);

self::assertSame('foo', $dto->listener);
self::assertSame('bar', $dto->method);
self::assertSame(10, $dto->priority);
$this->assertSame('foo', $dto->listener);
$this->assertSame('bar', $dto->method);
$this->assertSame(10, $dto->priority);
}
}
20 changes: 10 additions & 10 deletions tests/Config/EventsConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public function testGetsEmptyProcessors(): void
{
$config = new EventsConfig();

self::assertSame([], $config->getProcessors());
$this->assertSame([], $config->getProcessors());
}

public function testGetsProcessors(): void
Expand All @@ -26,14 +26,14 @@ public function testGetsProcessors(): void
'processors' => ['foo', 'bar']
]);

self::assertSame(['foo', 'bar'], $config->getProcessors());
$this->assertSame(['foo', 'bar'], $config->getProcessors());
}

public function testGetsEmptyListeners(): void
{
$config = new EventsConfig();

self::assertSame([], $config->getListeners());
$this->assertSame([], $config->getListeners());
}

public function testGetsListeners(): void
Expand All @@ -47,16 +47,16 @@ public function testGetsListeners(): void
]
]);

self::assertSame($listener, $config->getListeners()['foo'][1]);
self::assertInstanceOf(EventListener::class, $config->getListeners()['foo'][0]);
self::assertSame('bar', $config->getListeners()['foo'][0]->listener);
$this->assertSame($listener, $config->getListeners()['foo'][1]);
$this->assertInstanceOf(EventListener::class, $config->getListeners()['foo'][0]);
$this->assertSame('bar', $config->getListeners()['foo'][0]->listener);
}

public function testGetsEmptyInterceptors(): void
{
$config = new EventsConfig();

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

public function testGetsInterceptors(): void
Expand All @@ -73,8 +73,8 @@ public function process(string $controller, string $action, array $parameters, C
]
]);

self::assertSame('bar', $config->getInterceptors()[0]);
self::assertInstanceOf(CoreInterceptorInterface::class, $config->getInterceptors()[1]);
self::assertInstanceOf(Autowire::class, $config->getInterceptors()[2]);
$this->assertSame('bar', $config->getInterceptors()[0]);
$this->assertInstanceOf(CoreInterceptorInterface::class, $config->getInterceptors()[1]);
$this->assertInstanceOf(Autowire::class, $config->getInterceptors()[2]);
}
}
2 changes: 1 addition & 1 deletion tests/EventDispatcherTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ public function testDispatch(): void

$dispatcher = new EventDispatcher($core);

self::assertSame($event, $dispatcher->dispatch($event));
$this->assertSame($event, $dispatcher->dispatch($event));
}
}
2 changes: 1 addition & 1 deletion tests/Interceptor/CoreTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ public function testCallAction(): void

$core = new Core($dispatcher);

self::assertSame($event, $core->callAction('', '', ['event' => $event]));
$this->assertSame($event, $core->callAction('', '', ['event' => $event]));
}
}
10 changes: 5 additions & 5 deletions tests/Processor/AttributeProcessorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function testEventListenerShouldNotBeRegisteredWithListenerRegistry(): vo

$tokenizerRegistry->shouldReceive('addListener')
->once()
->withArgs(fn (AttributeProcessor $attributeProcessor): bool => true);
->withArgs(fn (AttributeProcessor $attributeProcessor) => true);

new AttributeProcessor($tokenizerRegistry, $reader, $factory, $listenerRegistry);
}
Expand Down Expand Up @@ -94,10 +94,10 @@ public function testProcess(string $class, Listener $listener, array $args, int

$processor->process();

self::assertSame((array)$args[0], $registry->events);
self::assertEquals($args[1], $registry->listener);
self::assertSame($args[2], $registry->priority);
self::assertSame($listeners, $registry->listeners);
$this->assertSame((array)$args[0], $registry->events);
$this->assertEquals($args[1], $registry->listener);
$this->assertSame($args[2], $registry->priority);
$this->assertSame($listeners, $registry->listeners);
}

public static function listenersDataProvider(): \Traversable
Expand Down
6 changes: 3 additions & 3 deletions tests/Processor/ConfigProcessorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ public function addListener(string $event, callable $listener, int $priority = 0
);
$processor->process();

self::assertSame($args[0], $registry->event);
self::assertEquals($args[1], $registry->listener);
self::assertSame($args[2], $registry->priority);
$this->assertSame($args[0], $registry->event);
$this->assertEquals($args[1], $registry->listener);
$this->assertSame($args[2], $registry->priority);
}

public static function listenersDataProvider(): \Traversable
Expand Down

0 comments on commit 620a016

Please sign in to comment.