Skip to content

Commit

Permalink
Adjust tests to remove phpstan errors
Browse files Browse the repository at this point in the history
  • Loading branch information
phil-davis committed Jan 23, 2023
1 parent a7c4512 commit 56b19ee
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
7 changes: 4 additions & 3 deletions tests/VObject/EmptyParameterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@ public function testRead(): void

$this->assertInstanceOf(Component\VCard::class, $vcard);
$vcard = $vcard->convert(\Sabre\VObject\Document::VCARD30);
$vcard = $vcard->serialize();
$serializedVcard = $vcard->serialize();

$converted = Reader::read($vcard);
$converted = Reader::read($serializedVcard);
$converted->validate();

/* @phpstan-ignore-next-line Offset 'X-INTERN' in isset() does not exist. */
$this->assertTrue(isset($converted->EMAIL['X-INTERN']));

$version = Version::VERSION;
Expand All @@ -45,7 +46,7 @@ public function testRead(): void
VCF;

$this->assertEquals($expected, str_replace("\r", '', $vcard));
$this->assertEquals($expected, str_replace("\r", '', $serializedVcard));
}

public function testVCard21Parameter(): void
Expand Down
16 changes: 12 additions & 4 deletions tests/VObject/ITip/BrokerTester.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Sabre\VObject\InvalidDataException;
use Sabre\VObject\ParseException;
use Sabre\VObject\PHPUnitAssertions;
use Sabre\VObject\Property;
use Sabre\VObject\Reader;
use Sabre\VObject\Recur\MaxInstancesExceededException;
use Sabre\VObject\Recur\NoInstancesException;
Expand Down Expand Up @@ -85,10 +86,17 @@ public function process(string $input, ?string $old = null, ?string $expected =
$message->sequence = isset($vcal->VEVENT[0]) ? $vcal->VEVENT[0]->SEQUENCE->getValue() : null;

if ('REPLY' === $message->method) {
$message->sender = $mainComponent->ATTENDEE->getValue();
$message->senderName = isset($mainComponent->ATTENDEE['CN']) ? $mainComponent->ATTENDEE['CN']->getValue() : null;
$message->recipient = $mainComponent->ORGANIZER->getValue();
$message->recipientName = isset($mainComponent->ORGANIZER['CN']) ? $mainComponent->ORGANIZER['CN'] : null;
/**
* @var Property<int, mixed> $attendee
*/
$attendee = $mainComponent->ATTENDEE;
$message->sender = $attendee->getValue();
/* @phpstan-ignore-next-line Offset 'CN' in isset() does not exist. Call to an undefined method getValue(). */
$message->senderName = isset($attendee['CN']) ? $attendee['CN']->getValue() : null;
$organizer = $mainComponent->ORGANIZER;
$message->recipient = $organizer->getValue();
/* @phpstan-ignore-next-line Offset 'CN' in isset() does not exist. */
$message->recipientName = isset($organizer['CN']) ? $organizer['CN'] : null;
}

$broker = new Broker();
Expand Down

0 comments on commit 56b19ee

Please sign in to comment.