function testFieldValueCanBeFilteredOnOutput() { $f = new T_Test_Filter_Suffix(); $out = new T_Test_Filter_Suffix('output'); $hidden = new T_Form_Hidden('alias', 'value'); $hidden->attachFilter($f); $this->assertSame($out->transform($f->transform('value')), $hidden->getFieldValue($out)); }
function testCanFilterDataOnExtraction() { $f = new T_Test_Filter_Suffix(); $cage = new T_Cage_Scalar('data'); $expect = $f->transform('data'); $test = $cage->filter($f)->uncage(); $this->assertSame($test, $expect); }
function testCanPipePriorFilter() { $map = new T_Test_Filter_Suffix(); $prior = new T_Test_Filter_ArrayPrefix(); $filter = new T_Filter_ArrayMap($map, $prior); $target = array('value'); $expect = $prior->transform(array('value')); foreach ($expect as &$element) { $element = $map->transform($element); } $this->assertSame($filter->transform($target), $expect); }
function testPipePriorFilter() { $prior = new T_Test_Filter_Suffix(); $filter = new T_Filter_ExpandShortPhpTag($prior); if (!ini_get('short_open_tag')) { $expected = $prior->transform('<?php echo "normal PHP"; ?>'); $this->assertSame($filter->transform('<?="normal PHP"; ?>'), $expected); } else { $expected = $prior->transform('<?="normal PHP"; ?>'); $this->assertSame($filter->transform('<?="normal PHP"; ?>'), $expected); } }
function testUrlCanBeFiltered() { $element = $this->getElement('content', 'url'); $f = new T_Test_Filter_Suffix(); $this->assertSame($f->transform('url'), $element->getUrl($f)); }
function testAltitudeCanBeFilteredOnRetrieval() { $f = new T_Test_Filter_Suffix(); $pt = new T_Geo_Point(40.23, 50.46, 231); $this->assertSame($f->transform(231), $pt->getAltitude($f)); }
function testCanFilterDataOnRetrievalWithNamespacedKey() { $session = $this->getDefaultSession(array('ns/str' => 'hello')); $f = new T_Test_Filter_Suffix(); $this->assertSame($f->transform('hello'), $session->get('ns/str', $f)); }
function testPipePriorFilter() { $pipe = new T_Test_Filter_Suffix(); $filter = new T_Filter_NormaliseEol(EOL, $pipe); $this->assertSame($filter->transform("multi\r\nline"), $pipe->transform('multi' . EOL . 'line')); }
function testgetExtCanApplyFilterToReturnValue() { $mime = new T_File_Mime('pdf'); $f = new T_Test_Filter_Suffix(); $this->assertSame($f->transform('pdf'), $mime->getExt($f)); }
function testPipePriorFilter() { $pipe = new T_Test_Filter_Suffix(' fox jumped'); $filter = new T_Validate_WordLimit(1, 20, $pipe); $this->assertSame($filter->transform('The quick brown'), $pipe->transform('The quick brown')); }
function testContentCanBeFilteredOnRetrieval() { $text = $this->getElement('content'); $filter = new T_Test_Filter_Suffix(); $this->assertSame($filter->transform('content'), $text->getContent($filter)); }
function testPostcodeCanBeFilteredOnRetrieval() { $f = new T_Test_Filter_Suffix(); $addr = $this->createAddress('Line 1', 'Line 2', 'City', 'State', 'P CODE', null); $this->assertSame($f->transform('P CODE'), $addr->getPostcode($f)); }
function testCanFilterConnectionName() { $pdo = $this->getConnection(); $f = new T_Test_Filter_Suffix('end'); $this->assertSame($f->transform($pdo->getName()), $pdo->getName($f)); }
function testLevelCanBeFilteredOnRetrieval() { $auth = new T_Auth(T_Auth::HUMAN); $f = new T_Test_Filter_Suffix(); $this->assertSame($f->transform(T_Auth::HUMAN), $auth->getLevel($f)); }
function testUrlCanBeFilteredOnRetrieval() { $f = new T_Test_Filter_Suffix(); $ctry = new T_Geo_Country(13, 'GB', 'United Kingdom', 'uk'); $this->assertSame($f->transform('uk'), $ctry->getUrl($f)); }
function testEmailCanBeFilteredOnRetrieval() { $user = new T_User(12, '*****@*****.**'); $f = new T_Test_Filter_Suffix('suffix'); $this->assertSame($f->transform($user->getEmail()), $user->getEmail($f)); }
function testDefaultCanBeFilteredDuringRetrieval() { $input = $this->getInputElement('myalias', 'mylabel'); $input->setDefault($this->getSampleDefault())->redisplayValid(true); if (is_array($this->getSampleDefault())) { $f = new T_Test_Filter_ArrayPrefix(); } else { $f = new T_Test_Filter_Suffix(); } $this->assertSame($f->transform($this->getSampleDefault()), $input->getDefault($f)); }
function testCanFilterConnectionName() { $factory = new T_Sqlite_Connection(':memory:'); $f = new T_Test_Filter_Suffix('end'); $this->assertSame($f->transform($factory->getName()), $factory->getName($f)); }