apply lsp-intelephense format to tests folder

pull/685/head
fadrian06 2 days ago
parent 17b300680d
commit 85c4b38858

@ -45,16 +45,14 @@ class DispatcherTest extends TestCase
public function testHasEvent(): void
{
$this->dispatcher->set('map-event', function (): void {
});
$this->dispatcher->set('map-event', function (): void {});
$this->assertTrue($this->dispatcher->has('map-event'));
}
public function testClearAllRegisteredEvents(): void
{
$customFunction = $anotherFunction = function (): void {
};
$customFunction = $anotherFunction = function (): void {};
$this->dispatcher
->set('map-event', $customFunction)
@ -71,8 +69,7 @@ class DispatcherTest extends TestCase
public function testClearDeclaredRegisteredEvent(): void
{
$customFunction = $anotherFunction = function (): void {
};
$customFunction = $anotherFunction = function (): void {};
$this->dispatcher
->set('map-event', $customFunction)
@ -246,8 +243,7 @@ class DispatcherTest extends TestCase
$output = '';
$invalidCallable = 'invalidGlobalFunction';
$validCallable = function (): void {
};
$validCallable = function (): void {};
$this->dispatcher->filter([$validCallable, $invalidCallable], $params, $output);
}

@ -96,8 +96,7 @@ class EngineTest extends TestCase
$engine = new Engine();
$this->expectException(Exception::class);
$this->expectExceptionMessage('Cannot override an existing framework method.');
$engine->map('_start', function () {
});
$engine->map('_start', function () {});
}
public function testRegisterExistingMethod(): void
@ -666,8 +665,7 @@ class EngineTest extends TestCase
public function testMiddlewareCallableFunctionReturnFalse(): void
{
$engine = new class extends Engine {
};
$engine = new class extends Engine {};
$engine->route('/path1/@id', function ($id) {
echo 'OK' . $id;
})
@ -794,8 +792,7 @@ class EngineTest extends TestCase
return false;
}
};
$engine = new class extends Engine {
};
$engine = new class extends Engine {};
$engine->route('/path1/@id', function ($id) {
echo 'OK' . $id;
@ -894,7 +891,8 @@ class EngineTest extends TestCase
$this->expectOutputString('before456before123OKafter123456after123');
}
public function testContainerBadClass() {
public function testContainerBadClass()
{
$engine = new Engine();
$this->expectException(InvalidArgumentException::class);
@ -902,7 +900,8 @@ class EngineTest extends TestCase
$engine->registerContainerHandler('BadClass');
}
public function testContainerDice() {
public function testContainerDice()
{
$engine = new Engine();
$dice = new \Dice\Dice();
$dice = $dice->addRules([
@ -922,7 +921,8 @@ class EngineTest extends TestCase
$this->expectOutputString('yay! I injected a collection, and it has 1 items');
}
public function testContainerDicePdoWrapperTest() {
public function testContainerDicePdoWrapperTest()
{
$engine = new Engine();
$dice = new \Dice\Dice();
$dice = $dice->addRules([
@ -942,7 +942,8 @@ class EngineTest extends TestCase
$this->expectOutputString('Yay! I injected a PdoWrapper, and it returned the number 5 from the database!');
}
public function testContainerDiceFlightEngine() {
public function testContainerDiceFlightEngine()
{
$engine = new Engine();
$engine->set('test_me_out', 'You got it boss!');
$dice = new \Dice\Dice();
@ -962,7 +963,8 @@ class EngineTest extends TestCase
$this->expectOutputString('You got it boss!');
}
public function testContainerDiceBadClass() {
public function testContainerDiceBadClass()
{
$engine = new Engine();
$dice = new \Dice\Dice();
$engine->registerContainerHandler(function ($class, $params) use ($dice) {
@ -978,7 +980,8 @@ class EngineTest extends TestCase
$engine->start();
}
public function testContainerDiceBadMethod() {
public function testContainerDiceBadMethod()
{
$engine = new Engine();
$dice = new \Dice\Dice();
$dice = $dice->addRules([
@ -1000,7 +1003,8 @@ class EngineTest extends TestCase
$engine->start();
}
public function testContainerPsr11(): void {
public function testContainerPsr11(): void
{
$engine = new Engine();
$container = new \League\Container\Container();
$container->add(Container::class)->addArgument(Collection::class)->addArgument(PdoWrapper::class);
@ -1015,7 +1019,8 @@ class EngineTest extends TestCase
$this->expectOutputString('yay! I injected a collection, and it has 1 items');
}
public function testContainerPsr11ClassNotFound() {
public function testContainerPsr11ClassNotFound()
{
$engine = new Engine();
$container = new \League\Container\Container();
$container->add(Container::class)->addArgument(Collection::class);
@ -1031,7 +1036,8 @@ class EngineTest extends TestCase
$engine->start();
}
public function testContainerPsr11MethodNotFound(): void {
public function testContainerPsr11MethodNotFound(): void
{
$engine = new Engine();
$container = new \League\Container\Container();
$container->add(Container::class)->addArgument(Collection::class)->addArgument(PdoWrapper::class);
@ -1048,7 +1054,8 @@ class EngineTest extends TestCase
$engine->start();
}
public function testRouteFoundButBadMethod(): void {
public function testRouteFoundButBadMethod(): void
{
$engine = new class extends Engine {
public function getLoader()
{
@ -1151,11 +1158,11 @@ class EngineTest extends TestCase
$this->assertContains('Content-Disposition: attachment; filename="something.txt"', $engine->response()->headersSent);
}
public function testDownloadBadPath() {
public function testDownloadBadPath()
{
$engine = new Engine();
$this->expectException(Exception::class);
$this->expectExceptionMessage("/path/to/nowhere cannot be found.");
$engine->download('/path/to/nowhere');
}
}

@ -122,8 +122,7 @@ class EventSystemTest extends TestCase
Flight::map('onEvent', function ($event, $callback) use (&$called) {
$called = true;
});
Flight::onEvent('test.event', function () {
});
Flight::onEvent('test.event', function () {});
$this->assertTrue($called, 'Overridden onEvent method should be called.');
}
@ -233,8 +232,7 @@ class EventSystemTest extends TestCase
{
$this->assertFalse(Flight::eventDispatcher()->hasListeners('test.event'), 'Event should not have listeners before registration');
Flight::onEvent('test.event', function () {
});
Flight::onEvent('test.event', function () {});
$this->assertTrue(Flight::eventDispatcher()->hasListeners('test.event'), 'Event should have listeners after registration');
}
@ -244,10 +242,8 @@ class EventSystemTest extends TestCase
*/
public function testGetListeners(): void
{
$callback1 = function () {
};
$callback2 = function () {
};
$callback1 = function () {};
$callback2 = function () {};
$this->assertEmpty(Flight::eventDispatcher()->getListeners('test.event'), 'Event should have no listeners before registration');
@ -277,10 +273,8 @@ class EventSystemTest extends TestCase
{
$this->assertEmpty(Flight::eventDispatcher()->getAllRegisteredEvents(), 'No events should be registered initially');
Flight::onEvent('test.event1', function () {
});
Flight::onEvent('test.event2', function () {
});
Flight::onEvent('test.event1', function () {});
Flight::onEvent('test.event2', function () {});
$events = Flight::eventDispatcher()->getAllRegisteredEvents();
$this->assertCount(2, $events, 'Should return all registered event names');
@ -317,12 +311,9 @@ class EventSystemTest extends TestCase
*/
public function testRemoveAllListeners(): void
{
Flight::onEvent('test.event', function () {
});
Flight::onEvent('test.event', function () {
});
Flight::onEvent('another.event', function () {
});
Flight::onEvent('test.event', function () {});
Flight::onEvent('test.event', function () {});
Flight::onEvent('another.event', function () {});
$this->assertTrue(Flight::eventDispatcher()->hasListeners('test.event'), 'Event should have listeners before removal');
$this->assertTrue(Flight::eventDispatcher()->hasListeners('another.event'), 'Another event should have listeners');
@ -339,8 +330,7 @@ class EventSystemTest extends TestCase
public function testRemoveListenersForNonexistentEvent(): void
{
// Should not throw any errors
Flight::eventDispatcher()->removeListener('nonexistent.event', function () {
});
Flight::eventDispatcher()->removeListener('nonexistent.event', function () {});
Flight::eventDispatcher()->removeAllListeners('nonexistent.event');
$this->assertTrue(true, 'Removing listeners for nonexistent events should not throw errors');

@ -31,6 +31,6 @@ class RenderTest extends TestCase
$this->app->render('hello', ['name' => 'Bob'], 'content');
$this->app->render('layouts/layout');
$this->expectOutputString('<html>Hello, Bob!</html>');
$this->expectOutputString("<body>Hello, Bob!</body>\n");
}
}

@ -411,16 +411,14 @@ class RouterTest extends TestCase
public function testRouteBeingReturned(): void
{
$route = $this->router->map('/hi', function () {
});
$route = $this->router->map('/hi', function () {});
$route_in_router = $this->router->getRoutes()[0];
$this->assertSame($route, $route_in_router);
}
public function testRouteSetAlias(): void
{
$route = $this->router->map('/hi', function () {
});
$route = $this->router->map('/hi', function () {});
$route->setAlias('hello');
$this->assertEquals('hello', $route->alias);
}

@ -104,7 +104,7 @@ class ViewTest extends TestCase
$this->view->render('world');
$this->expectOutputString('Hello world, Bob!');
$this->expectOutputString("Hello world, Bob!\n");
}
public function testGetTemplateAbsolutePath(): void

@ -7,9 +7,7 @@ namespace tests\classes;
class Factory
{
// Cannot be instantiated
private function __construct()
{
}
private function __construct() {}
public static function create(): self
{

@ -6,31 +6,17 @@ namespace tests\groupcompactsyntax;
final class PostsController
{
public function index(): void
{
}
public function index(): void {}
public function show(string $id): void
{
}
public function show(string $id): void {}
public function create(): void
{
}
public function create(): void {}
public function store(): void
{
}
public function store(): void {}
public function edit(string $id): void
{
}
public function edit(string $id): void {}
public function update(string $id): void
{
}
public function update(string $id): void {}
public function destroy(string $id): void
{
}
public function destroy(string $id): void {}
}

@ -6,11 +6,7 @@ namespace tests\groupcompactsyntax;
final class TodosController
{
public function index(): void
{
}
public function index(): void {}
public function show(string $id): void
{
}
public function show(string $id): void {}
}

@ -1 +1 @@
<html><?php echo $content; ?></html>
<body><?= $content ?></body>

Loading…
Cancel
Save