Skip to content

Commit 681eff9

Browse files
committed
test: enable files_external for tests
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
1 parent a19dd3b commit 681eff9

File tree

6 files changed

+29
-19
lines changed

6 files changed

+29
-19
lines changed

.github/workflows/phpunit-mariadb.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,14 @@ jobs:
2929
with:
3030
persist-credentials: false
3131

32+
- name: Checkout viewer
33+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
34+
with:
35+
persist-credentials: false
36+
path: apps/viewer
37+
ref: ${{ matrix.server-versions }}
38+
repository: nextcloud/viewer
39+
3240
- name: Get version matrix
3341
id: versions
3442
uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.3.1

.github/workflows/phpunit-sqlite.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,14 @@ jobs:
9494
persist-credentials: false
9595
path: apps/${{ env.APP_NAME }}
9696

97+
- name: Checkout viewer
98+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
99+
with:
100+
persist-credentials: false
101+
path: apps/viewer
102+
ref: ${{ matrix.server-versions }}
103+
repository: nextcloud/viewer
104+
97105
- name: Set up php ${{ matrix.php-versions }}
98106
uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1 # v2.36.0
99107
with:

appinfo/info.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@
3535
<screenshot>https://raw.githubusercontent.com/nextcloud/maps/master/screenshots/screenshot2.png</screenshot>
3636
<screenshot>https://raw.githubusercontent.com/nextcloud/maps/master/screenshots/screenshot3.png</screenshot>
3737
<dependencies>
38-
<php min-version="8.1" max-version="8.4"/>
38+
<php min-version="8.1" max-version="8.5"/>
3939
<lib>exif</lib>
40-
<nextcloud min-version="31" max-version="32"/>
40+
<nextcloud min-version="32" max-version="33"/>
4141
</dependencies>
4242
<repair-steps>
4343
<post-migration>

tests/Unit/Controller/PhotosControllerTest.php

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
use OCA\Maps\Service\PhotofilesService;
1919
use OCP\DB\QueryBuilder\IQueryBuilder;
2020
use OCP\IServerContainer;
21+
use OCP\Server;
2122

2223
class PhotosControllerTest extends \PHPUnit\Framework\TestCase {
2324
private $appName;
@@ -134,12 +135,12 @@ protected function setUp(): void {
134135
$file->delete();
135136
}
136137
// delete db
137-
$qb = $c->query(IServerContainer::class)->query(\OCP\IDBConnection::class)->getQueryBuilder();
138+
$qb = Server::get(\OCP\IDBConnection::class)->getQueryBuilder();
138139
$qb->delete('maps_photos')
139140
->where(
140141
$qb->expr()->eq('user_id', $qb->createNamedParameter('test', IQueryBuilder::PARAM_STR))
141142
);
142-
$req = $qb->execute();
143+
$req = $qb->executeStatement();
143144
}
144145

145146
public static function tearDownAfterClass(): void {
@@ -351,13 +352,6 @@ public function testAddGetPhotos() {
351352
$data = $resp->getData();
352353
$this->assertCount(1, $data);
353354

354-
//We do not clear the cache so we expect to still 1 photo
355-
$resp = $this->photosController->getPhotos();
356-
$status = $resp->getStatus();
357-
$this->assertEquals(200, $status);
358-
$data = $resp->getData();
359-
$this->assertCount(1, $data);
360-
361355
//And we expect that there is still zero non Localized Photo
362356
$resp = $this->photosController->getNonLocalizedPhotos();
363357
$status = $resp->getStatus();

tests/Unit/Controller/TracksControllerTest.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use OCA\Maps\Service\TracksService;
1717
use OCP\DB\QueryBuilder\IQueryBuilder;
1818
use OCP\IServerContainer;
19+
use OCP\Server;
1920

2021
class TracksControllerTest extends \PHPUnit\Framework\TestCase {
2122
private $appName;
@@ -135,12 +136,12 @@ protected function setUp(): void {
135136
$file->delete();
136137
}
137138
// delete db
138-
$qb = $c->query(IServerContainer::class)->query(\OCP\IDBConnection::class)->getQueryBuilder();
139+
$qb = Server::get(\OCP\IDBConnection::class)->getQueryBuilder();
139140
$qb->delete('maps_tracks')
140141
->where(
141142
$qb->expr()->eq('user_id', $qb->createNamedParameter('test', IQueryBuilder::PARAM_STR))
142143
);
143-
$req = $qb->execute();
144+
$req = $qb->executeStatement();
144145
}
145146

146147
public static function tearDownAfterClass(): void {
@@ -167,12 +168,12 @@ protected function tearDown(): void {
167168
$file->delete();
168169
}
169170
// delete db
170-
$qb = $c->query(IServerContainer::class)->query(\OCP\IDBConnection::class)->getQueryBuilder();
171+
$qb = Server::get(\OCP\IDBConnection::class)->getQueryBuilder();
171172
$qb->delete('maps_tracks')
172173
->where(
173174
$qb->expr()->eq('user_id', $qb->createNamedParameter('test', IQueryBuilder::PARAM_STR))
174175
);
175-
$req = $qb->execute();
176+
$req = $qb->executeStatement();
176177
}
177178

178179
public function testAddGetTracks() {

tests/bootstrap.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@
1515
use OCP\App\IAppManager;
1616
use OCP\Server;
1717

18-
require_once __DIR__ . '/../../../tests/bootstrap.php';
19-
require_once __DIR__ . '/../../../lib/base.php';
20-
require_once __DIR__ . '/../vendor/autoload.php';
18+
require_once __DIR__ . '/../../../tests/autoload.php';
2119

22-
Server::get(IAppManager::class)->loadApp('maps');
20+
$appManager = Server::get(IAppManager::class);
21+
$appManager->loadApp('maps');

0 commit comments

Comments
 (0)