Exemple #1
0
 public function filter($value)
 {
     if (!$value) {
         return null;
     }
     return parent::filter($value);
 }
Exemple #2
0
 /**
  * @group ZF-11344
  */
 public function testRaisesExceptionIfEncodingMismatchDetectedAndFinalStringIsEmpty()
 {
     if (version_compare(phpversion(), '5.4', '>=')) {
         $this->markTestIncomplete('Code to test is not compatible with PHP 5.4 ');
     }
     $string = file_get_contents(dirname(__FILE__) . '/_files/latin-1-dash-only.txt');
     // restore_error_handler can emit an E_WARNING; let's ignore that, as
     // we want to test the returned value
     // Also, explicit try, so that we don't mess up PHPUnit error handlers
     set_error_handler(array($this, 'errorHandler'), E_NOTICE | E_WARNING);
     try {
         $result = $this->_filter->filter($string);
         $this->fail('Expected exception from single non-utf-8 character');
     } catch (\Exception $e) {
         $this->assertTrue($e instanceof Exception\DomainException);
     }
 }
Exemple #3
0
 /**
  * @group ZF-8995
  */
 public function testConfigObject()
 {
     $options = array('quotestyle' => 5, 'encoding' => 'ISO-8859-1');
     $config = new \Zend\Config\Config($options);
     $filter = new HtmlEntitiesFilter($config);
     $this->assertEquals('ISO-8859-1', $filter->getEncoding());
     $this->assertEquals(5, $filter->getQuoteStyle());
 }
Exemple #4
0
 /**
  * @dataProvider returnUnfilteredDataProvider
  * @return void
  */
 public function testReturnUnfiltered($input)
 {
     $this->assertEquals($input, $this->_filter->filter($input));
 }