|
3 | 3 | namespace Utopia\Http; |
4 | 4 |
|
5 | 5 | use PHPUnit\Framework\TestCase; |
6 | | -use Utopia\DI\Container; |
7 | 6 | use Utopia\Http\Tests\UtopiaFPMRequestTest; |
8 | 7 | use Utopia\Validator\Text; |
9 | 8 | use Utopia\Http\Adapter\FPM\Request; |
@@ -47,15 +46,6 @@ protected function restoreRequest(): void |
47 | 46 | $_SERVER['REQUEST_URI'] = $this->uri; |
48 | 47 | } |
49 | 48 |
|
50 | | - public function testCanInjectContainerInConstructor(): void |
51 | | - { |
52 | | - $container = new Container(); |
53 | | - $http = new Http(new Server(), 'Asia/Tel_Aviv', $container); |
54 | | - |
55 | | - $this->assertSame($container, $http->getContainer()); |
56 | | - $this->assertInstanceOf(Container::class, (new Http(new Server(), 'Asia/Tel_Aviv'))->getContainer()); |
57 | | - } |
58 | | - |
59 | 49 | public function testCanRegisterResourcesWithPublicApi(): void |
60 | 50 | { |
61 | 51 | $this->http->setResource('rand', fn () => 1234); |
@@ -608,43 +598,6 @@ public function testCanRunRequest(): void |
608 | 598 | $this->assertStringNotContainsString('HELLO', $result); |
609 | 599 | } |
610 | 600 |
|
611 | | - public function testScopedResourcesUseNestedContainers(): void |
612 | | - { |
613 | | - $counter = 0; |
614 | | - $http = new class (new Server(), 'Asia/Tel_Aviv') extends Http { |
615 | | - public function defineResource(string $name, callable $callback, array $injections = [], ?Container $scope = null): void |
616 | | - { |
617 | | - $this->setResource($name, $callback, $injections, $scope); |
618 | | - } |
619 | | - |
620 | | - public function resource(string $name, Container $scope): mixed |
621 | | - { |
622 | | - return $this->getResource($name, $scope); |
623 | | - } |
624 | | - }; |
625 | | - |
626 | | - $http->defineResource('shared', function () use (&$counter) { |
627 | | - $counter++; |
628 | | - |
629 | | - return $counter; |
630 | | - }); |
631 | | - |
632 | | - $requestA = new Container($http->getContainer()); |
633 | | - $requestB = new Container($http->getContainer()); |
634 | | - $executionA = new Container($requestA); |
635 | | - |
636 | | - $http->defineResource('requestId', fn () => 'request-a', scope: $requestA); |
637 | | - $http->defineResource('requestId', fn () => 'request-b', scope: $requestB); |
638 | | - $http->defineResource('requestId', fn () => 'execution-a', scope: $executionA); |
639 | | - |
640 | | - $this->assertSame(1, $http->resource('shared', $requestA)); |
641 | | - $this->assertSame(1, $http->resource('shared', $requestB)); |
642 | | - $this->assertSame('request-a', $http->resource('requestId', $requestA)); |
643 | | - $this->assertSame('request-b', $http->resource('requestId', $requestB)); |
644 | | - $this->assertSame('execution-a', $http->resource('requestId', $executionA)); |
645 | | - $this->assertSame('request-a', $http->resource('requestId', $requestA)); |
646 | | - } |
647 | | - |
648 | 601 | public function testWildcardRoute(): void |
649 | 602 | { |
650 | 603 | $method = $_SERVER['REQUEST_METHOD'] ?? null; |
|
0 commit comments