Teilnahmerechnungen erstellen
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit;
|
||||
|
||||
use App\Support\Text;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class TextTest extends TestCase
|
||||
{
|
||||
public function test_blank_input_becomes_null(): void
|
||||
{
|
||||
// Optionale Formularfelder kommen als Leerstring an, nicht als null.
|
||||
$this->assertNull(Text::nullIfBlank(null));
|
||||
$this->assertNull(Text::nullIfBlank(''));
|
||||
$this->assertNull(Text::nullIfBlank(' '));
|
||||
$this->assertNull(Text::nullIfBlank("\t\n"));
|
||||
}
|
||||
|
||||
public function test_content_is_kept_and_trimmed(): void
|
||||
{
|
||||
$this->assertSame('Musterweg 1', Text::nullIfBlank(' Musterweg 1 '));
|
||||
$this->assertSame('WM', Text::nullIfBlank('WM'));
|
||||
}
|
||||
|
||||
public function test_a_zero_is_content_not_emptiness(): void
|
||||
{
|
||||
// "0" ist falsy -- eine naive Prüfung mit `empty()` würde die Angabe verschlucken.
|
||||
$this->assertSame('0', Text::nullIfBlank('0'));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user