diff options
Diffstat (limited to 'tests/lib/AppFramework/AppTest.php')
-rw-r--r-- | tests/lib/AppFramework/AppTest.php | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/tests/lib/AppFramework/AppTest.php b/tests/lib/AppFramework/AppTest.php index 3c535a4bf7a..f9b7cf50675 100644 --- a/tests/lib/AppFramework/AppTest.php +++ b/tests/lib/AppFramework/AppTest.php @@ -9,9 +9,10 @@ namespace Test\AppFramework; use OC\AppFramework\App; +use OC\AppFramework\DependencyInjection\DIContainer; use OC\AppFramework\Http\Dispatcher; use OCP\AppFramework\Controller; -use OCP\AppFramework\Http; +use OCP\AppFramework\Http\IOutput; use OCP\AppFramework\Http\Response; function rrmdir($directory) { @@ -28,7 +29,7 @@ function rrmdir($directory) { class AppTest extends \Test\TestCase { - private $container; + private DIContainer $container; private $io; private $api; private $controller; @@ -43,10 +44,10 @@ class AppTest extends \Test\TestCase { protected function setUp(): void { parent::setUp(); - $this->container = new \OC\AppFramework\DependencyInjection\DIContainer('test', []); + $this->container = new DIContainer('test', []); $this->controller = $this->createMock(Controller::class); $this->dispatcher = $this->createMock(Dispatcher::class); - $this->io = $this->createMock(Http\IOutput::class); + $this->io = $this->createMock(IOutput::class); $this->headers = ['key' => 'value']; $this->output = 'hi'; @@ -54,19 +55,19 @@ class AppTest extends \Test\TestCase { $this->controllerMethod = 'method'; $this->container[$this->controllerName] = $this->controller; - $this->container['Dispatcher'] = $this->dispatcher; - $this->container['OCP\\AppFramework\\Http\\IOutput'] = $this->io; + $this->container[Dispatcher::class] = $this->dispatcher; + $this->container[IOutput::class] = $this->io; $this->container['urlParams'] = ['_route' => 'not-profiler']; $this->appPath = __DIR__ . '/../../../apps/namespacetestapp'; $infoXmlPath = $this->appPath . '/appinfo/info.xml'; mkdir($this->appPath . '/appinfo', 0777, true); - $xml = '<?xml version="1.0" encoding="UTF-8"?>' . - '<info>' . - '<id>namespacetestapp</id>' . - '<namespace>NameSpaceTestApp</namespace>' . - '</info>'; + $xml = '<?xml version="1.0" encoding="UTF-8"?>' + . '<info>' + . '<id>namespacetestapp</id>' + . '<namespace>NameSpaceTestApp</namespace>' + . '</info>'; file_put_contents($infoXmlPath, $xml); } @@ -124,16 +125,14 @@ class AppTest extends \Test\TestCase { App::main($this->controllerName, $this->controllerMethod, $this->container, []); } - public function dataNoOutput() { + public static function dataNoOutput(): array { return [ ['HTTP/2.0 204 No content'], ['HTTP/2.0 304 Not modified'], ]; } - /** - * @dataProvider dataNoOutput - */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataNoOutput')] public function testNoOutput(string $statusCode): void { $return = [$statusCode, [], [], $this->output, new Response()]; $this->dispatcher->expects($this->once()) @@ -166,7 +165,7 @@ class AppTest extends \Test\TestCase { } public function testCoreApp(): void { - $this->container['AppName'] = 'core'; + $this->container['appName'] = 'core'; $this->container['OC\Core\Controller\Foo'] = $this->controller; $this->container['urlParams'] = ['_route' => 'not-profiler']; @@ -184,7 +183,7 @@ class AppTest extends \Test\TestCase { } public function testSettingsApp(): void { - $this->container['AppName'] = 'settings'; + $this->container['appName'] = 'settings'; $this->container['OCA\Settings\Controller\Foo'] = $this->controller; $this->container['urlParams'] = ['_route' => 'not-profiler']; @@ -202,7 +201,7 @@ class AppTest extends \Test\TestCase { } public function testApp(): void { - $this->container['AppName'] = 'bar'; + $this->container['appName'] = 'bar'; $this->container['OCA\Bar\Controller\Foo'] = $this->controller; $this->container['urlParams'] = ['_route' => 'not-profiler']; |