✨feature: Initial commit
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
/**
|
||||
* Logo sanitizer tests.
|
||||
*
|
||||
* @package LogoSoup\Tests
|
||||
*/
|
||||
|
||||
use LogoSoup\Support\Logo_Sanitizer;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* Tests collection sanitization.
|
||||
*/
|
||||
class LogoSanitizerTest extends TestCase {
|
||||
/**
|
||||
* Test invalid rows are removed.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_sanitize_collection_skips_invalid_entries() {
|
||||
$sanitized = Logo_Sanitizer::sanitize_collection(
|
||||
array(
|
||||
array(
|
||||
'id' => '4',
|
||||
'url' => 'https://example.com/logo.svg',
|
||||
'alt' => '<b>Alpha</b>',
|
||||
'link' => 'https://example.com',
|
||||
),
|
||||
array(
|
||||
'alt' => 'Missing URL',
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
$this->assertCount( 1, $sanitized );
|
||||
$this->assertSame( 'Alpha', $sanitized[0]['alt'] );
|
||||
$this->assertSame( 4, $sanitized[0]['id'] );
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user