Skip to content

Commit

Permalink
Standardize CI and move unit tests to Unit folder
Browse files Browse the repository at this point in the history
  • Loading branch information
phil-davis committed Dec 6, 2018
1 parent 28d448b commit 9e10d2f
Show file tree
Hide file tree
Showing 14 changed files with 47 additions and 96 deletions.
43 changes: 23 additions & 20 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ workspace:
branches: [master, release*, release/*]

pipeline:
install-server:
install-core:
image: owncloudci/core
version: ${OC_VERSION}
pull: true
Expand All @@ -16,7 +16,7 @@ pipeline:
db_password: owncloud
when:
matrix:
NEED_SERVER: true
NEED_CORE: true

install-app:
image: owncloudci/php:${PHP_VERSION}
Expand Down Expand Up @@ -85,7 +85,6 @@ pipeline:
image: owncloudci/php:${PHP_VERSION}
pull: true
environment:
- PHP_VERSION=${PHP_VERSION}
- COVERAGE=${COVERAGE}
commands:
- if [ -z "${COVERAGE}" ]; then make test-php-unit; fi
Expand All @@ -98,20 +97,20 @@ pipeline:
image: plugins/codecov:2
secrets: [codecov_token]
pull: true
files:
- tests/output/clover.xml
paths:
- tests/output/*.xml
when:
matrix:
COVERAGE: true

notify:
image: plugins/slack:1
pull: true
secrets: [ slack_webhook ]
secrets: [slack_webhook]
channel: builds
when:
status: [ failure, changed ]
event: [ push, tag ]
status: [failure, changed]
event: [push, tag]

services:
mysql:
Expand Down Expand Up @@ -168,24 +167,28 @@ matrix:
- PHP_VERSION: 7.2
OC_VERSION: daily-master-qa
TEST_SUITE: codecheck
NEED_CORE: true
NEED_SERVER: true
NEED_INSTALL_APP: true

- PHP_VERSION: 7.2
OC_VERSION: daily-master-qa
TEST_SUITE: codecheck-deprecations
NEED_CORE: true
NEED_SERVER: true
NEED_INSTALL_APP: true

- PHP_VERSION: 7.1
OC_VERSION: daily-stable10-qa
TEST_SUITE: codecheck
NEED_CORE: true
NEED_SERVER: true
NEED_INSTALL_APP: true

- PHP_VERSION: 7.1
OC_VERSION: daily-stable10-qa
TEST_SUITE: codecheck-deprecations
NEED_CORE: true
NEED_SERVER: true
NEED_INSTALL_APP: true

Expand All @@ -195,71 +198,71 @@ matrix:
TEST_SUITE: phpunit
DB_TYPE: sqlite
DB_NAME: owncloud
NEED_SERVER: true
NEED_CORE: true
NEED_INSTALL_APP: true

- PHP_VERSION: 7.1
OC_VERSION: daily-master-qa
TEST_SUITE: phpunit
DB_TYPE: mysql
DB_NAME: owncloud
NEED_SERVER: true
NEED_CORE: true
NEED_INSTALL_APP: true

- PHP_VERSION: 7.1
OC_VERSION: daily-master-qa
TEST_SUITE: phpunit
DB_TYPE: pgsql
DB_NAME: owncloud
NEED_SERVER: true
NEED_CORE: true
NEED_INSTALL_APP: true

- PHP_VERSION: 7.1
OC_VERSION: daily-master-qa
TEST_SUITE: phpunit
DB_TYPE: oci
DB_NAME: XE
NEED_SERVER: true
NEED_CORE: true
NEED_INSTALL_APP: true

- PHP_VERSION: 7.2
OC_VERSION: daily-master-qa
TEST_SUITE: phpunit
DB_TYPE: mysql
DB_NAME: owncloud
NEED_SERVER: true
NEED_CORE: true
NEED_INSTALL_APP: true

- PHP_VERSION: 5.6
OC_VERSION: daily-stable10-qa
TEST_SUITE: phpunit
DB_TYPE: sqlite
DB_NAME: owncloud
NEED_SERVER: true
NEED_CORE: true
NEED_INSTALL_APP: true

- PHP_VERSION: 5.6
OC_VERSION: daily-stable10-qa
TEST_SUITE: phpunit
DB_TYPE: mysql
DB_NAME: owncloud
NEED_SERVER: true
NEED_CORE: true
NEED_INSTALL_APP: true

- PHP_VERSION: 7.0
OC_VERSION: daily-stable10-qa
TEST_SUITE: phpunit
DB_TYPE: mysql
DB_NAME: owncloud
NEED_SERVER: true
NEED_CORE: true
NEED_INSTALL_APP: true

- PHP_VERSION: 7.0
OC_VERSION: daily-stable10-qa
TEST_SUITE: phpunit
DB_TYPE: pgsql
DB_NAME: owncloud
NEED_SERVER: true
NEED_CORE: true
NEED_INSTALL_APP: true
COVERAGE: true

Expand All @@ -268,21 +271,21 @@ matrix:
TEST_SUITE: phpunit
DB_TYPE: oci
DB_NAME: XE
NEED_SERVER: true
NEED_CORE: true
NEED_INSTALL_APP: true

- PHP_VERSION: 7.1
OC_VERSION: daily-stable10-qa
TEST_SUITE: phpunit
DB_TYPE: mysql
DB_NAME: owncloud
NEED_SERVER: true
NEED_CORE: true
NEED_INSTALL_APP: true

- PHP_VERSION: 7.2
OC_VERSION: daily-stable10-qa
TEST_SUITE: phpunit
DB_TYPE: mysql
DB_NAME: owncloud
NEED_SERVER: true
NEED_CORE: true
NEED_INSTALL_APP: true
15 changes: 5 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,14 @@ nbproject
.well-known
/.buildpath

# Tests - auto-generated files
/tests/coverage*
/tests/clover.xml
/tests/output/clover.xml
/tests/js/node_modules
/tests/output/

build

/build/
/l10n/.transifexrc
.php_cs.cache

# Composer
composer.phar
vendor/
vendor-bin/**/composer.lock
vendor-bin/**/vendor

# Tests - auto-generated files
/tests/output
6 changes: 3 additions & 3 deletions phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
<phpunit bootstrap="../../tests/bootstrap.php"
strict="true"
verbose="true"
failOnWarning="true"
timeoutForSmallTests="900"
timeoutForMediumTests="900"
timeoutForLargeTests="900"
>
>
<testsuite name='unit'>
<directory suffix='Test.php'>./tests</directory>
<directory suffix='Test.php'>./tests/Unit</directory>
</testsuite>
<!-- filters for code coverage -->
<filter>
Expand All @@ -21,4 +22,3 @@
<log type="coverage-clover" target="./tests/output/clover.xml"/>
</logging>
</phpunit>

Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
*
*/

namespace OCA\AnnouncementCenter\Tests\Activity;
namespace OCA\AnnouncementCenter\Tests\Unit\Activity;

use OCA\AnnouncementCenter\Activity\Extension;
use OCA\AnnouncementCenter\Manager;
use OCA\AnnouncementCenter\Tests\TestCase;
use OCA\AnnouncementCenter\Tests\Unit\TestCase;
use OCP\Activity\IExtension;
use OCP\Activity\IManager;
use OCP\IL10N;
Expand Down
6 changes: 3 additions & 3 deletions tests/AppInfo/AppTest.php → tests/Unit/AppInfo/AppTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*
*/

namespace OCA\AnnouncementCenter\Tests;
namespace OCA\AnnouncementCenter\Tests\Unit;

/**
* Class AppTest
Expand Down Expand Up @@ -94,7 +94,7 @@ public function testAppActivity() {
$this->assertInstanceOf('\OCA\AnnouncementCenter\Activity\Extension', $navigation);
});

include(__DIR__ . '/../../appinfo/app.php');
include(__DIR__ . '/../../../appinfo/app.php');
}

public function testAppNotification() {
Expand All @@ -118,6 +118,6 @@ public function testAppNotification() {
$this->assertInternalType('string', $info['name']);
});

include(__DIR__ . '/../../appinfo/app.php');
include(__DIR__ . '/../../../appinfo/app.php');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
*
*/

namespace OCA\AnnouncementCenter\Tests\AppInfo;
namespace OCA\AnnouncementCenter\Tests\Unit\AppInfo;

use OCA\AnnouncementCenter\AppInfo\Application;
use OCA\AnnouncementCenter\Tests\TestCase;
use OCA\AnnouncementCenter\Tests\Unit\TestCase;

/**
* Class ApplicationTest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
*
*/

namespace OCA\AnnouncementCenter\Tests;
namespace OCA\AnnouncementCenter\Tests\Unit;

class RoutesTest extends TestCase {
public function testRoutes() {
$routes = include(__DIR__ . '/../../appinfo/routes.php');
$routes = include(__DIR__ . '/../../../appinfo/routes.php');
$this->assertInternalType('array', $routes);
$this->assertCount(1, $routes);
$this->assertArrayHasKey('routes', $routes);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,10 @@
*
*/

namespace OCA\AnnouncementCenter\Tests;
namespace OCA\AnnouncementCenter\Tests\Unit;

use OCA\AnnouncementCenter\Manager;
use OCP\Activity\IManager;
use OCP\AppFramework\Http;
use OCP\IURLGenerator;
use OCP\IUserManager;
use OCP\Notification\IManager as INotificationManager;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
*
*/

namespace OCA\AnnouncementCenter\Tests\Controller;
namespace OCA\AnnouncementCenter\Tests\Unit\Controller;

use OCA\AnnouncementCenter\Manager;
use OCA\AnnouncementCenter\Tests\TestCase;
use OCA\AnnouncementCenter\Tests\Unit\TestCase;
use OCP\AppFramework\Http;
use OCP\BackgroundJob\IJobList;
use OCP\IGroupManager;
Expand Down
2 changes: 1 addition & 1 deletion tests/ManagerTest.php → tests/Unit/ManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*
*/

namespace OCA\AnnouncementCenter\Tests;
namespace OCA\AnnouncementCenter\Tests\Unit;

use OCA\AnnouncementCenter\Manager;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
*
*/

namespace OCA\AnnouncementCenter\Tests\Notification;
namespace OCA\AnnouncementCenter\Tests\Unit\Notification;

use OCA\AnnouncementCenter\Notification\Notifier;
use OCA\AnnouncementCenter\Manager;
use OCA\AnnouncementCenter\Tests\TestCase;
use OCA\AnnouncementCenter\Tests\Unit\TestCase;
use OCP\IL10N;
use OCP\IUserManager;
use OCP\L10N\IFactory;
Expand Down
2 changes: 1 addition & 1 deletion tests/TestCase.php → tests/Unit/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*
*/

namespace OCA\AnnouncementCenter\Tests;
namespace OCA\AnnouncementCenter\Tests\Unit;

abstract class TestCase extends \Test\TestCase {
/** @var array */
Expand Down
41 changes: 0 additions & 41 deletions tests/bootstrap.php

This file was deleted.

Loading

0 comments on commit 9e10d2f

Please sign in to comment.