Skip to content

Commit

Permalink
Fixed tests 1
Browse files Browse the repository at this point in the history
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
  • Loading branch information
skjnldsv committed Dec 29, 2017
1 parent 00111c2 commit e5bb608
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 155 deletions.
141 changes: 0 additions & 141 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -695,149 +695,8 @@ pipeline:
TEST: memcache-redis-cluster
matrix:
include:
- TESTS: checkers
- TESTS: nodb-codecov
ENABLE_REDIS: true
- TESTS: db-codecov
ENABLE_REDIS: true
- DB: NODB
PHP: 5.6
ENABLE_REDIS: true
- DB: NODB
PHP: 7.0
ENABLE_REDIS: true
- DB: NODB
PHP: 7.1
ENABLE_REDIS: true
- DB: NODB
PHP: 7.2
ENABLE_REDIS: false
- DB: sqlite
PHP: 5.6
ENABLE_REDIS: true
- DB: sqlite
PHP: 7.0
ENABLE_REDIS: true
- DB: sqlite
PHP: 7.1
ENABLE_REDIS: true
- DB: sqlite
PHP: 7.2
ENABLE_REDIS: false
- DB: mysql
PHP: 5.6
ENABLE_REDIS: true
- DB: mysql
PHP: 7.0
ENABLE_REDIS: true
- DB: mysql
PHP: 7.1
ENABLE_REDIS: true
- DB: mysql
PHP: 7.2
ENABLE_REDIS: false
- DB: mysql5.6
PHP: 5.6
ENABLE_REDIS: true
- DB: mysql5.6
PHP: 7.0
ENABLE_REDIS: true
- DB: mysql5.6
PHP: 7.1
ENABLE_REDIS: true
- DB: mysql5.5
PHP: 5.6
ENABLE_REDIS: true
- DB: mysql5.5
PHP: 7.0
ENABLE_REDIS: true
- DB: mysql5.5
PHP: 7.1
ENABLE_REDIS: true
- DB: postgres
PHP: 5.6
POSTGRES: 9
ENABLE_REDIS: true
- DB: postgres
PHP: 7.0
POSTGRES: 9
ENABLE_REDIS: true
- DB: postgres
PHP: 7.1
POSTGRES: 9
ENABLE_REDIS: true
- DB: postgres
PHP: 7.1
POSTGRES: 10
ENABLE_REDIS: true
- DB: mysqlmb4
PHP: 5.6
ENABLE_REDIS: true
- DB: mysqlmb4
PHP: 7.0
ENABLE_REDIS: true
- DB: mysqlmb4
PHP: 7.1
ENABLE_REDIS: true
- DB: mysqlmb4
PHP: 7.2
ENABLE_REDIS: false
- TESTS: integration-capabilities_features
- TESTS: integration-federation_features
- TESTS: integration-maintenance-mode
- TESTS: integration-ratelimiting
ENABLE_REDIS: true
- TESTS: integration-auth
- TESTS: integration-carddav
- TESTS: integration-dav-v2
- TESTS: integration-ocs-v1
- TESTS: integration-sharing-v1
- TESTS: integration-sharing-v1-part2
- TESTS: integration-sharing-v1-part3
- TESTS: integration-checksums
- TESTS: integration-external-storage
- TESTS: integration-provisioning-v1
- TESTS: integration-tags
- TESTS: integration-caldav
- TESTS: integration-comments
- TESTS: integration-favorites
- TESTS: integration-provisioning-v2
- TESTS: integration-webdav-related
- TESTS: integration-sharees-features
- TESTS: integration-sharees-v2-features
- TESTS: integration-setup-features
- TESTS: integration-filesdrop-features
- TESTS: integration-transfer-ownership-features
- TESTS: integration-ldap-features
- TESTS: integration-trashbin
- TESTS: integration-remote-api
- TESTS: acceptance
TESTS-ACCEPTANCE: access-levels
- TESTS: acceptance
TESTS-ACCEPTANCE: app-files
- TESTS: acceptance
TESTS-ACCEPTANCE: app-theming
- TESTS: acceptance
TESTS-ACCEPTANCE: login
- TESTS: jsunit
- TESTS: syntax-php5.6
- TESTS: syntax-php7.0
- TESTS: syntax-php7.1
- TESTS: phan
- TESTS: litmus-v1
- TESTS: litmus-v2
- TESTS: caldavtester-old-endpoint
- TESTS: caldavtester-new-endpoint
- TESTS: carddavtester-new-endpoint
- TESTS: carddavtester-old-endpoint
- TESTS: object-store
OBJECT_STORE: s3
- TESTS: sqlite-php7.0-samba-native
- TESTS: sqlite-php7.0-samba-non-native
- TEST: memcache-memcached
- TEST: memcache-redis-cluster
ENABLE_REDIS_CLUSTER: true
- TESTS: sqlite-php7.0-webdav-apache
ENABLE_REDIS: true

services:
Expand Down
2 changes: 1 addition & 1 deletion lib/private/Template/SCSSCacher.php
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ private function prependBaseurlPrefix($cssFile) {
*/
private function getWebDir($path, $appName, $serverRoot, $webRoot) {
// Detect if path is within server root AND if path is within an app path
if ( !strpos($path, $serverRoot) && $appWebPath = \OC_App::getAppWebPath($appName) ) {
if ( strpos($path, $serverRoot) === false && $appWebPath = \OC_App::getAppWebPath($appName)) {
// Get the file path within the app directory
$appDirectoryPath = explode($appName, $path)[1];
// Remove the webroot
Expand Down
11 changes: 11 additions & 0 deletions tests/lib/LegacyHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,17 @@
use OC_Helper;

class LegacyHelperTest extends \Test\TestCase {
/** @var string */
private $originalWebRoot;

public function setUp() {
$this->originalWebRoot = \OC::$WEBROOT;
}

public function tearDown() {
// Reset webRoot
\OC::$WEBROOT = $this->originalWebRoot;
}

/**
* @dataProvider humanFileSizeProvider
Expand Down
24 changes: 13 additions & 11 deletions tests/lib/Template/SCSSCacherTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -384,17 +384,6 @@ public function testGetCachedSCSS($appName, $fileName, $result) {
$this->assertEquals(substr($result, 1), $actual);
}

public function dataGetWebDir() {
return [
['/http/core/css', 'core', '', '/http', '/core/css'],
['/http/apps/test/css', 'test', '', '/http', '/apps/test/css'],
['/http/nextcloud/core/css', 'core', '/nextcloud', '/http/nextcloud', '/nextcloud/core/css'],
['/http/nextcloud/apps/test/css', 'test', '/nextcloud', '/http/nextcloud', '/nextcloud/apps/test/css'],
['/srv/apps2/test/css', 'test', '', '/http', '/apps2/test/css'],
['/srv/apps2/test/css', 'test', '/nextcloud', '/http/nextcloud', '/apps2/test/css']
];
}

private function randomString() {
return sha1(uniqid(mt_rand(), true));
}
Expand All @@ -411,6 +400,19 @@ private function rrmdir($directory) {
return rmdir($directory);
}

public function dataGetWebDir() {
return [
// Root installation
['/http/core/css', 'core', '', '/http', '/core/css'],
['/http/apps/scss/css', 'scss', '', '/http', '/apps/scss/css'],
['/srv/apps2/scss/css', 'scss', '', '/http', '/apps2/scss/css'],
// Sub directory install
['/http/nextcloud/core/css', 'core', '/nextcloud', '/http/nextcloud', '/nextcloud/core/css'],
['/http/nextcloud/apps/scss/css', 'scss', '/nextcloud', '/http/nextcloud', '/nextcloud/apps/scss/css'],
['/srv/apps2/scss/css', 'scss', '/nextcloud', '/http/nextcloud', '/apps2/scss/css']
];
}

/**
* @param $path
* @param $appName
Expand Down
10 changes: 8 additions & 2 deletions tests/lib/UrlGeneratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ class UrlGeneratorTest extends \Test\TestCase {
private $request;
/** @var IURLGenerator */
private $urlGenerator;
/** @var string */
private $originalWebRoot;

public function setUp() {
parent::setUp();
Expand All @@ -38,6 +40,12 @@ public function setUp() {
$this->cacheFactory,
$this->request
);
$this->originalWebRoot = \OC::$WEBROOT;
}

public function tearDown() {
// Reset webRoot
\OC::$WEBROOT = $this->originalWebRoot;
}

private function mockBaseUrl() {
Expand All @@ -47,7 +55,6 @@ private function mockBaseUrl() {
$this->request->expects($this->once())
->method('getServerHost')
->willReturn('localhost');

}

/**
Expand Down Expand Up @@ -156,4 +163,3 @@ public function testGetBaseUrl() {
}

}

0 comments on commit e5bb608

Please sign in to comment.