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
22 changes: 20 additions & 2 deletions .github/workflows/lint-and-analyse-php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,29 @@ jobs:
# Ignore zip for php-webdriver/webdriver
composer-options: "--ignore-platform-req=ext-zip"

- name: Create config.php for unit tests
- name: Create main config.php for unit tests
run: cp config/config.dist.php config/config.php

- name: Create plugin config.php for unit tests
run: |
for source in $(find plugins -type f -name "*dist*"); do
target=$(echo "${source}" | sed -e "s/.dist//")
if ! [ -f "config/$(basename ${target})" ]; then
cp --no-clobber "${source}" "config/$(basename ${target})"
sudo chown www-data:www-data "config/$(basename ${target})"
fi
if ! [ -f ${target} ]; then
ln -s "config/$(basename ${target})" "${target}"
fi
done

- name: Unit Tests
run: composer phpunit
run: |
composer phpunit | tee phpunit.log
if ! grep -qE "Tests:|OK \(" phpunit.log; then
echo "❌ PHPUnit exited early (no summary line found)"
exit 1
fi

lint-php-files:
runs-on: ubuntu-latest
Expand Down
6 changes: 3 additions & 3 deletions Presenters/Admin/Import/ICalImportPresenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,14 @@ public function Import()

foreach ($events as $event) {
try {
if (empty($event->LOCATION)) {
$location = (string) $event->LOCATION;
if (empty($location)) {
$numberSkipped++;
Log::Debug('Skipping ics import - missing resource');
continue;
}

$location = (string)$event->LOCATION;
$organizer = isset($event->ORGANIZER) ? (string)$event->ORGANIZER : '';
$organizer = isset($event->ORGANIZER) ? (string) $event->ORGANIZER : '';

$user = $this->GetOrCreateUser($organizer);
$resource = $this->GetOrCreateResource($location);
Expand Down
7 changes: 7 additions & 0 deletions lib/Common/Validators/EmailValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ public function __construct($email)

public function Validate()
{
// Check for null or empty email first
if (empty($this->email)) {
$this->isValid = false;
$this->AddMessageKey('ValidEmailRequired');
return;
}

$validator = new EguliasValidator();
$this->isValid = $validator->isValid($this->email, new RFCValidation());

Expand Down
2 changes: 1 addition & 1 deletion phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ parameters:
message: '#^Access to an undefined property TestAdLdapEntry\:\:\$fooName\.$#'
identifier: property.notFound
count: 1
path: tests/Plugins/Authentication/ActiveDirectory/ActiveDirectoryTest_BROKEN.php
path: tests/Plugins/Authentication/ActiveDirectory/ActiveDirectoryTest.php

-
message: '#^PHPDoc tag @var with type array\<Attribute\> is not subtype of native type array\{LBAttribute\}\.$#'
Expand Down
23 changes: 12 additions & 11 deletions tests/Presenters/Admin/ImportICalPresenterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,23 +107,24 @@ private function GetEvents()
X-WR-TIMEZONE:Europe/Berlin
X-WR-CALDESC:Nur zum testen vom Google Kalender
BEGIN:VEVENT
ATTENDEE;CN="Page, Larry <l.page@google.com> (l.page@google.com)";ROLE=REQ-PARTICIPANT;RSVP=FALSE:mailto:l.page@google.com
ATTENDEE;CN="Brin, Sergey <s.brin@google.com> (s.brin@google.com)";ROLE=REQ-PARTICIPANT;RSVP=TRUE:mailto:s.brin@google.com
ATTENDEE;CN="Page, Larry <l.page@google.com> (l.page@google.com)";
ROLE=REQ-PARTICIPANT;RSVP=FALSE:mailto:l.page@google.com
ATTENDEE;CN="Page, Larry <l.page@google.com> (l.page@google.com)";
ROLE=REQ-PARTICIPANT;RSVP=FALSE:mailto:l.page@google.com
DTSTART;VALUE=DATE:20160112
DTEND;VALUE=DATE:20160116
DTSTAMP;TZID="GMT Standard Time":20110121T195741Z
UID:1koigufm110c5hnq6ln57murd4@google.com
CREATED:20110119T142901Z
DESCRIPTION;LANGUAGE=en-gb:Project xyz Review Meeting Minutes\n
Agenda\n1. Review of project version 1.0 requirements.\n2.
Definition
of project processes.\n3. Review of project schedule.\n
Participants: John Smith, Jane Doe, Jim Dandy\n-It was
decided that the requirements need to be signed off by
product marketing.\n-Project processes were accepted.\n
DESCRIPTION;LANGUAGE=en-gb:Project xyz Review Meeting Minutes
Agenda 1. Review of project version 1.0 requirements. 2.
Definition of project processes.\\n3. Review of project schedule.
Participants: John Smith, Jane Doe, Jim Dandy\\n-It was
decided that the requirements need to be signed off by
product marketing.\\n-Project processes were accepted.\\n
-Project schedule needs to account for scheduled holidays
and employee vacation time. Check with HR for specific
dates.\n-New schedule will be distributed by Friday.\n-
and employee vacation time. Check with HR for specific
dates.\\n-New schedule will be distributed by Friday.\\n-
Next weeks meeting is cancelled. No meeting until 3/23.
LAST-MODIFIED:20150409T150000Z
LOCATION:name1
Expand Down
2 changes: 1 addition & 1 deletion tests/Presenters/CheckoutPresenterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public function testExecutesPayPalPayment()

$gateway = new FakePayPalGateway();
$this->paymentRepository->_PayPal = $gateway;
$gateway->_Payment->state = "approved";
$gateway->_Payment->status = "COMPLETED";

$this->presenter->ExecutePayPalPayment();

Expand Down