refactor: Cleanup git state - commit all staged changes
Major refactoring cleanup: - Add new controller architecture (class-controller-*.php) - Add new settings-v2 UI (views/settings-v2/) - Add new CSS architecture (agentic-sidebar.css, tokens) - Add esbuild build pipeline (scripts/build.js, package.json) - Add composer dependencies (vendor/) - Add frontend src directory (assets/js/src/index.jsx) - Add documentation files - Remove old/obsolete files (class-settings.php, old CSS) This commits all pending changes from previous refactoring efforts.
This commit is contained in:
97
vendor/symfony/contracts/Tests/Service/ServiceSubscriberTraitTest.php
vendored
Normal file
97
vendor/symfony/contracts/Tests/Service/ServiceSubscriberTraitTest.php
vendored
Normal file
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Contracts\Tests\Service;
|
||||
|
||||
use PHPUnit\Framework\Attributes\Group;
|
||||
use PHPUnit\Framework\Attributes\IgnoreDeprecations;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psr\Container\ContainerInterface;
|
||||
use Symfony\Contracts\Service\Attribute\Required;
|
||||
use Symfony\Contracts\Service\Attribute\SubscribedService;
|
||||
use Symfony\Contracts\Service\ServiceLocatorTrait;
|
||||
use Symfony\Contracts\Service\ServiceSubscriberInterface;
|
||||
use Symfony\Contracts\Service\ServiceSubscriberTrait;
|
||||
|
||||
#[IgnoreDeprecations]
|
||||
#[Group('legacy')]
|
||||
class ServiceSubscriberTraitTest extends TestCase
|
||||
{
|
||||
public static function setUpBeforeClass(): void
|
||||
{
|
||||
class_exists(LegacyTestService::class);
|
||||
}
|
||||
|
||||
public function testMethodsOnParentsAndChildrenAreIgnoredInGetSubscribedServices()
|
||||
{
|
||||
$expected = [
|
||||
LegacyTestService::class.'::aService' => Service2::class,
|
||||
LegacyTestService::class.'::nullableInAttribute' => '?'.Service2::class,
|
||||
LegacyTestService::class.'::nullableReturnType' => '?'.Service2::class,
|
||||
new SubscribedService(LegacyTestService::class.'::withAttribute', Service2::class, true, new Required()),
|
||||
];
|
||||
|
||||
$this->assertEquals($expected, LegacyChildTestService::getSubscribedServices());
|
||||
}
|
||||
|
||||
public function testSetContainerIsCalledOnParent()
|
||||
{
|
||||
$container = new class([]) implements ContainerInterface {
|
||||
use ServiceLocatorTrait;
|
||||
};
|
||||
|
||||
$this->assertSame($container, (new LegacyTestService())->setContainer($container));
|
||||
}
|
||||
|
||||
public function testParentNotCalledIfHasMagicCall()
|
||||
{
|
||||
$container = new class([]) implements ContainerInterface {
|
||||
use ServiceLocatorTrait;
|
||||
};
|
||||
$service = new class extends LegacyParentWithMagicCall {
|
||||
use ServiceSubscriberTrait;
|
||||
|
||||
private $container;
|
||||
};
|
||||
|
||||
$this->assertNull($service->setContainer($container));
|
||||
$this->assertSame([], $service::getSubscribedServices());
|
||||
}
|
||||
|
||||
public function testParentNotCalledIfNoParent()
|
||||
{
|
||||
$container = new class([]) implements ContainerInterface {
|
||||
use ServiceLocatorTrait;
|
||||
};
|
||||
$service = new class {
|
||||
use ServiceSubscriberTrait;
|
||||
|
||||
private $container;
|
||||
};
|
||||
|
||||
$this->assertNull($service->setContainer($container));
|
||||
$this->assertSame([], $service::getSubscribedServices());
|
||||
}
|
||||
|
||||
public function testSetContainerCalledFirstOnParent()
|
||||
{
|
||||
$container1 = new class([]) implements ContainerInterface {
|
||||
use ServiceLocatorTrait;
|
||||
};
|
||||
$container2 = clone $container1;
|
||||
|
||||
$testService = new class extends LegacyParentTestService2 implements ServiceSubscriberInterface {
|
||||
use ServiceSubscriberTrait;
|
||||
};
|
||||
$this->assertNull($testService->setContainer($container1));
|
||||
$this->assertSame($container1, $testService->setContainer($container2));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user