Page MenuHomeWickedGov Phorge

CentralNoticeTest.php
No OneTemporary

Size
1003 B
Referenced Files
None
Subscribers
None

CentralNoticeTest.php

<?php
/**
* @group Fundraising
* @group Database
* @group CentralNotice
* @covers CentralNotice
*/
class CentralNoticeTest extends PHPUnit\Framework\TestCase {
public function testDropdownList() {
$text = 'Weight';
$values = range( 0, 50, 10 );
$this->assertEquals(
"*Weight\n**0\n**10\n**20\n**30\n**40\n**50\n",
CentralNotice::dropdownList( $text, $values ) );
}
public static function provideSearchTerms() {
return [
'empty' => [ '', '' ],
'whitespace normalization' => [ "\n\n a\tb \r", 'a b' ],
'allowed characters' => [ 'a-to-z_A-to-Z_0-to-9', 'a-to-z_A-to-Z_0-to-9' ],
'bad characters are trimmed' => [ '!("a")', 'a' ],
'bad characters cut off terms' => [ 'what:happens (??and??here??)', 'what and' ],
];
}
/**
* @dataProvider provideSearchTerms
*/
public function testSanitizeSearchTerms( string $terms, string $expected ) {
$instance = new CentralNotice();
$this->assertSame( $expected, $instance->sanitizeSearchTerms( $terms ) );
}
}

File Metadata

Mime Type
text/x-php
Expires
Fri, Jul 3, 19:19 (1 d, 12 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
81/07/09f73170b618ec29185539948be9
Default Alt Text
CentralNoticeTest.php (1003 B)

Event Timeline