Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
33 changes: 2 additions & 31 deletions tests/integration/features/bootstrap/AppConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
use Behat\Behat\Hook\Scope\BeforeScenarioScope;
use GuzzleHttp\Message\ResponseInterface;


require __DIR__ . '/../../../../lib/composer/autoload.php';

trait AppConfiguration {
Expand Down Expand Up @@ -67,41 +68,11 @@ abstract protected function resetAppConfigs();

/**
* @BeforeScenario
*
* Enable the testing app before the first scenario of the feature and
* reset the configs before each scenario
* @param BeforeScenarioScope $event
*/
public function prepareParameters(BeforeScenarioScope $event){
public function prepareParametersBeforeScenario(){
$user = $this->currentUser;
$this->currentUser = 'admin';

$scenarios = $event->getFeature()->getScenarios();
if ($event->getScenario() === reset($scenarios)) {
$this->setStatusTestingApp(true);
}

$this->resetAppConfigs();

$this->currentUser = $user;
}

/**
* @AfterScenario
*
* Reset the values after the last scenario of the feature and disable the testing app
* @param AfterScenarioScope $event
*/
public function undoChangingParameters(AfterScenarioScope $event) {
$scenarios = $event->getFeature()->getScenarios();
if ($event->getScenario() === end($scenarios)) {
$user = $this->currentUser;
$this->currentUser = 'admin';

$this->resetAppConfigs();

$this->setStatusTestingApp(false);
$this->currentUser = $user;
}
}
}
4 changes: 2 additions & 2 deletions tests/integration/features/bootstrap/CalDavContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ public function __construct($baseUrl) {
}
}

/** @BeforeScenario */
/** @BeforeScenario @caldav */
public function setUpScenario() {
$this->client = new Client();
$this->responseXml = '';
}

/** @AfterScenario */
/** @AfterScenario @caldav */
public function afterScenario() {
$davUrl = $this->baseUrl. '/remote.php/dav/calendars/admin/MyCalendar';
try {
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/features/bootstrap/CardDavContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ public function __construct($baseUrl) {
}
}

/** @BeforeScenario */
/** @BeforeScenario @carddav*/
public function setUpScenario() {
$this->client = new Client();
$this->responseXml = '';
}


/** @AfterScenario */
/** @AfterScenario @carddav*/
public function afterScenario() {
$davUrl = $this->baseUrl . '/remote.php/dav/addressbooks/users/admin/MyAddressbook';
try {
Expand Down
57 changes: 30 additions & 27 deletions tests/integration/features/caldav.feature
Original file line number Diff line number Diff line change
@@ -1,31 +1,34 @@
Feature: caldav
Scenario: Accessing a not existing calendar of another user
Given user "user0" exists
When "admin" requests calendar "user0/MyCalendar"
Then The CalDAV HTTP status code should be "404"
And The exception is "Sabre\DAV\Exception\NotFound"
And The error message is "Node with name 'MyCalendar' could not be found"

# Blocked by https://github.com/php/php-src/pull/1417
#Scenario: Accessing a not shared calendar of another user
# Given user "user0" exists
# Given "admin" creates a calendar named "MyCalendar"
# Given The CalDAV HTTP status code should be "201"
# When "user0" requests calendar "admin/MyCalendar"
# Then The CalDAV HTTP status code should be "404"
# And The exception is "Sabre\DAV\Exception\NotFound"
# And The error message is "Node with name 'MyCalendar' could not be found"
@caldav
Scenario: Accessing a not existing calendar of another user
Given user "user0" exists
When "admin" requests calendar "user0/MyCalendar"
Then The CalDAV HTTP status code should be "404"
And The exception is "Sabre\DAV\Exception\NotFound"
And The error message is "Node with name 'MyCalendar' could not be found"

Scenario: Accessing a not existing calendar of myself
Given user "user0" exists
When "user0" requests calendar "admin/MyCalendar"
Then The CalDAV HTTP status code should be "404"
And The exception is "Sabre\DAV\Exception\NotFound"
And The error message is "Node with name 'MyCalendar' could not be found"
@caldav
Scenario: Accessing a not shared calendar of another user
Given user "user0" exists
Given "admin" creates a calendar named "MyCalendar"
Given The CalDAV HTTP status code should be "201"
When "user0" requests calendar "admin/MyCalendar"
Then The CalDAV HTTP status code should be "404"
And The exception is "Sabre\DAV\Exception\NotFound"
And The error message is "Node with name 'MyCalendar' could not be found"

# Blocked by https://github.com/php/php-src/pull/1417
#Scenario: Creating a new calendar
# When "admin" creates a calendar named "MyCalendar"
# Then The CalDAV HTTP status code should be "201"
# And "admin" requests calendar "admin/MyCalendar"
# Then The CalDAV HTTP status code should be "200"
@caldav
Scenario: Accessing a not existing calendar of myself
Given user "user0" exists
When "user0" requests calendar "admin/MyCalendar"
Then The CalDAV HTTP status code should be "404"
And The exception is "Sabre\DAV\Exception\NotFound"
And The error message is "Node with name 'MyCalendar' could not be found"

@caldav
Scenario: Creating a new calendar
When "admin" creates a calendar named "MyCalendar"
Then The CalDAV HTTP status code should be "201"
And "admin" requests calendar "admin/MyCalendar"
Then The CalDAV HTTP status code should be "200"
4 changes: 4 additions & 0 deletions tests/integration/features/carddav.feature
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
Feature: carddav
@carddav
Scenario: Accessing a not existing addressbook of another user
Given user "user0" exists
When "admin" requests addressbook "user0/MyAddressbook" with statuscode "404"
And The CardDAV exception is "Sabre\DAV\Exception\NotFound"
And The CardDAV error message is "Addressbook with name 'MyAddressbook' could not be found"

@carddav
Scenario: Accessing a not shared addressbook of another user
Given user "user0" exists
Given "admin" creates an addressbook named "MyAddressbook" with statuscode "201"
When "user0" requests addressbook "admin/MyAddressbook" with statuscode "404"
And The CardDAV exception is "Sabre\DAV\Exception\NotFound"
And The CardDAV error message is "Addressbook with name 'MyAddressbook' could not be found"

@carddav
Scenario: Accessing a not existing addressbook of myself
Given user "user0" exists
When "user0" requests addressbook "admin/MyAddressbook" with statuscode "404"
And The CardDAV exception is "Sabre\DAV\Exception\NotFound"
And The CardDAV error message is "Addressbook with name 'MyAddressbook' could not be found"

@carddav
Scenario: Creating a new addressbook
When "admin" creates an addressbook named "MyAddressbook" with statuscode "201"
Then "admin" requests addressbook "admin/MyAddressbook" with statuscode "200"
6 changes: 5 additions & 1 deletion tests/integration/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ SCENARIO_TO_RUN=$1
HIDE_OC_LOGS=$2

function env_alt_home_enable {
$OCC app:enable testing
$OCC config:app:set testing enable_alt_user_backend --value yes
}

Expand Down Expand Up @@ -79,6 +78,8 @@ $OCC config:system:set skeletondirectory --value="$(pwd)/skeleton"
#Enable external storage app
$OCC config:app:set core enable_external_storage --value=yes

$OCC app:enable testing

mkdir -p work/local_storage || { echo "Unable to create work folder" >&2; exit 1; }
OUTPUT_CREATE_STORAGE=`$OCC files_external:create local_storage local null::null -c datadir=$SCRIPT_PATH/work/local_storage`

Expand Down Expand Up @@ -123,6 +124,9 @@ $OCC files_external:delete -y $ID_STORAGE
#Disable external storage app
$OCC config:app:set core enable_external_storage --value=no

$OCC app:disable testing


# Clear storage folder
rm -Rf work/local_storage/*

Expand Down