2017 © Pedro Peláez
 

library nextcloud_testing

Simple and fast unit and integration testing framework for Nextcloud, based on PHPUnit

image

christophwurst/nextcloud_testing

Simple and fast unit and integration testing framework for Nextcloud, based on PHPUnit

  • Monday, March 12, 2018
  • by ChristophWurst
  • Repository
  • 1 Watchers
  • 0 Stars
  • 5,111 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 6 Versions
  • 57 % Grown

The README.md

Nextcloud Testing

Simple and fast unit and integration testing framework for Nextcloud 25+, based on PHPUnit, (*1)

Features * Minimal setUp/tearDown overhead for unit tests * Simple trait-based mechanism to reset database after integration tests * Based on PHPUnit, (*2)

Unit Tests

Use TestCase as base class for your test case:, (*3)

<?php

use ChristophWurst\Nextcloud\Testing\TestCase;

class ControllerTest extends TestCase {

    … your test code …

}

Integration Tests

Include the DatabaseTransaction trait in your test case and any changes to the database will be rolled back after each test:, (*4)

<?php

use ChristophWurst\Nextcloud\Testing\DatabaseTransaction;
use ChristophWurst\Nextcloud\Testing\TestCase;

class ControllerTest extends TestCase {

    use DatabaseTransaction;

    … your test code …

}

Selenium Tests

Include the Selenium trait in your test case and access the Webdriver instance via $this->webDriver:, (*5)

<?php

use ChristophWurst\Nextcloud\Testing\Selenium;
use ChristophWurst\Nextcloud\Testing\TestCase;

class ControllerTest extends TestCase {

    use Selenium;

    public function testWithSelenium() {
        …

        $this->webDriver->get('http://localhost:8080/index.php/login');

        …
    }

}

This framework targets Sauce Labs as testing back-end that runs the test browser instances. Hence, it is necessary to set the SAUCE_USERNAME and SAUCE_ACCESS_KEY env variables. SELENIUM_BROWSER lets you choose the browser to run your tests against., (*6)

Test Users

Include the TestUser trait in your test case to conveniently generate new test users. The trait will create a new user with a random UID (including collision detection)., (*7)

<?php

use ChristophWurst\Nextcloud\Testing\TestCase;
use ChristophWurst\Nextcloud\Testing\TestUser;

class ControllerTest extends TestCase {

    use TestUser;

    public function testWithSelenium() {
        …

        $user = $this->createTestUser();

        …
    }

}

The returned user is of type IUser. You can read its UID with $user->getUID(). Note that the user is not removed after the test., (*8)

The Versions

12/03 2018

dev-fix/oc-guzzle-client

dev-fix/oc-guzzle-client

Simple and fast unit and integration testing framework for Nextcloud, based on PHPUnit

  Sources   Download

MIT

The Requires

 

The Development Requires

by Christoph Wurst

12/03 2018

0.3.1

0.3.1.0

Simple and fast unit and integration testing framework for Nextcloud, based on PHPUnit

  Sources   Download

MIT

The Requires

 

The Development Requires

by Christoph Wurst

26/02 2018

dev-master

9999999-dev

Simple and fast unit and integration testing framework for Nextcloud, based on PHPUnit

  Sources   Download

MIT

The Requires

 

The Development Requires

by Christoph Wurst

19/02 2018

0.3.0

0.3.0.0

Simple and fast unit and integration testing framework for Nextcloud, based on PHPUnit

  Sources   Download

MIT

The Requires

 

The Development Requires

by Christoph Wurst

19/02 2018

0.2.0

0.2.0.0

Simple and fast unit and integration testing framework for Nextcloud, based on PHPUnit

  Sources   Download

MIT

The Requires

 

The Development Requires

by Christoph Wurst

12/02 2018

0.1.0

0.1.0.0

Simple and fast unit and integration testing framework for Nextcloud, based on PHPUnit

  Sources   Download

MIT

The Requires

 

The Development Requires

by Christoph Wurst