123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- <?php
- declare(strict_types=1);
- namespace lib\AppFramework\Bootstrap;
- use OC\AppFramework\Bootstrap\BootContext;
- use OCP\AppFramework\IAppContainer;
- use OCP\IServerContainer;
- use PHPUnit\Framework\MockObject\MockObject;
- use Test\TestCase;
- class BootContextTest extends TestCase {
-
- private $appContainer;
-
- private $context;
- protected function setUp(): void {
- parent::setUp();
- $this->appContainer = $this->createMock(IAppContainer::class);
- $this->context = new BootContext(
- $this->appContainer
- );
- }
- public function testGetAppContainer(): void {
- $container = $this->context->getAppContainer();
- $this->assertSame($this->appContainer, $container);
- }
- public function testGetServerContainer(): void {
- $serverContainer = $this->createMock(IServerContainer::class);
- $this->appContainer->method('get')
- ->with(IServerContainer::class)
- ->willReturn($serverContainer);
- $container = $this->context->getServerContainer();
- $this->assertSame($serverContainer, $container);
- }
- }
|