Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat(CI): Add integration test helper app
Signed-off-by: Joas Schilling <[email protected]>
  • Loading branch information
nickvergessen authored and juliusknorr committed Mar 31, 2023
commit 6d42ae35ea7de859e2add6451e69c266c0dfcb7d
27 changes: 27 additions & 0 deletions tests/Integration/app/appinfo/info.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0"?>
<info xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://apps.nextcloud.com/schema/apps/info.xsd">
<id>files_accesscontrol_testing</id>
<name>Files AccessControl Testing</name>
<summary><![CDATA[1]]></summary>
<description><![CDATA[2]]></description>

<version>0.3.0</version>
<licence>agpl</licence>
<author>Joas Schilling</author>
<namespace>FilesAccessControlTesting</namespace>

<types>
<logging/>
</types>

<category>tools</category>

<website>https://github.com/nextcloud/files_accesscontrol</website>
<bugs>https://github.com/nextcloud/files_accesscontrol/issues</bugs>
<repository>https://github.com/nextcloud/files_accesscontrol.git</repository>

<dependencies>
<nextcloud min-version="25" max-version="25" />
</dependencies>
</info>
30 changes: 30 additions & 0 deletions tests/Integration/app/appinfo/routes.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

declare(strict_types=1);
/**
* @author Joas Schilling <[email protected]>
*
* @copyright Copyright (c) 2023 Joas Schilling <[email protected]>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

return [
'ocs' => [
['name' => 'Endpoint#reset', 'url' => '', 'verb' => 'DELETE'],
],
];
55 changes: 55 additions & 0 deletions tests/Integration/app/lib/Controller/EndpointController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?php

declare(strict_types=1);
/**
* @author Joas Schilling <[email protected]>
*
* @copyright Copyright (c) 2023 Joas Schilling <[email protected]>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

namespace OCA\FilesAccessControlTesting\Controller;

use OCP\AppFramework\OCSController;
use OCP\AppFramework\Http\DataResponse;
use OCP\IDBConnection;
use OCP\IRequest;

class EndpointController extends OCSController {

public function __construct(
string $appName,
IRequest $request,
protected IDBConnection $db,
) {
parent::__construct($appName, $request);
}

/**
* @return DataResponse
*/
public function reset(): DataResponse {
$query = $this->db->getQueryBuilder();

$query->delete('flow_checks')->executeStatement();
$query->delete('flow_operations')->executeStatement();
$query->delete('flow_operations_scope')->executeStatement();

return new DataResponse();
}
}
5 changes: 5 additions & 0 deletions tests/Integration/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ composer install
#PHPPID=$!
#echo $PHPPID

cp -R ./app "../../../${APP_NAME}_testing"
${ROOT_DIR}/occ app:enable $APP_NAME
${ROOT_DIR}/occ app:enable --force "${APP_NAME}_testing"
${ROOT_DIR}/occ app:list | grep $APP_NAME

export TEST_SERVER_URL="http://localhost:8080/"
Expand All @@ -19,4 +21,7 @@ RESULT=$?

#kill $PHPPID

${ROOT_DIR}/occ app:disable "${APP_NAME}_testing"
rm -rf "../../../${APP_NAME}_testing"

exit $RESULT