First Commit

This commit is contained in:
GMrrc
2024-11-06 15:35:54 +01:00
commit 5a887f38dd
87 changed files with 1990 additions and 0 deletions

9
tests/bootstrap.php Normal file
View File

@ -0,0 +1,9 @@
<?php
declare(strict_types=1);
require_once __DIR__ . '/../../../tests/bootstrap.php';
require_once __DIR__ . '/../vendor/autoload.php';
\OC_App::loadApp(OCA\WebServer\AppInfo\Application::APP_ID);
OC_Hook::clear();

View File

12
tests/phpunit.xml Normal file
View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="bootstrap.php" timeoutForSmallTests="900" timeoutForMediumTests="900" timeoutForLargeTests="900" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.4/phpunit.xsd" cacheDirectory=".phpunit.cache">
<testsuite name="Web Server Tests">
<directory suffix="Test.php">.</directory>
</testsuite>
<source>
<include>
<directory suffix=".php">../appinfo</directory>
<directory suffix=".php">../lib</directory>
</include>
</source>
</phpunit>

View File

View File

@ -0,0 +1,19 @@
<?php
declare(strict_types=1);
namespace Controller;
use OCA\WebServer\AppInfo\Application;
use OCA\WebServer\Controller\ApiController;
use OCP\IRequest;
use PHPUnit\Framework\TestCase;
class ApiTest extends TestCase {
public function testIndex() {
$request = $this->createMock(IRequest::class);
$controller = new ApiController(Application::APP_ID, $request);
$this->assertEquals($controller->index()->getData()['message'], 'Hello world!');
}
}