mirror of
https://github.com/dwaxweiler/connector-mobilizon
synced 2025-04-24 23:28:45 +02:00
handle location being null
This commit is contained in:
parent
460ea7894d
commit
5bcc03f9d1
@ -10,6 +10,7 @@
|
|||||||
#### Fixed
|
#### Fixed
|
||||||
- Mark event-related data as non-translatable within plugin
|
- Mark event-related data as non-translatable within plugin
|
||||||
- Add version number to script registration to break browser caching
|
- Add version number to script registration to break browser caching
|
||||||
|
- Handle location being null
|
||||||
#### Security
|
#### Security
|
||||||
|
|
||||||
### [1.2.0]
|
### [1.2.0]
|
||||||
|
@ -26,7 +26,7 @@ final class Formatter
|
|||||||
return $dateText;
|
return $dateText;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function format_location(string $description, string $locality): string {
|
public static function format_location(string $description, ?string $locality): string {
|
||||||
$location = '';
|
$location = '';
|
||||||
if ($description && trim($description)) {
|
if ($description && trim($description)) {
|
||||||
$location .= trim($description);
|
$location .= trim($description);
|
||||||
|
@ -42,6 +42,10 @@ final class FormatterTest extends PHPUnit\Framework\TestCase
|
|||||||
$this->assertSame('a', Formatter::format_location('a', ''));
|
$this->assertSame('a', Formatter::format_location('a', ''));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testLocationFormatDescriptionOnlyWithNull(): void {
|
||||||
|
$this->assertSame('a', Formatter::format_location('a', null));
|
||||||
|
}
|
||||||
|
|
||||||
public function testLocationFormatDescriptionWithSpaceOnly(): void {
|
public function testLocationFormatDescriptionWithSpaceOnly(): void {
|
||||||
$this->assertSame('', Formatter::format_location(' ', ''));
|
$this->assertSame('', Formatter::format_location(' ', ''));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user