Example #1
0
 public static function pregMatchSafe($pattern, $subject, $matches = null, $flags = 0, $offset = 0)
 {
     $handler_terminator = PHPUnit_Util_ErrorHandler::handleErrorOnce(E_WARNING);
     $match = preg_match($pattern, $subject, $matches, $flags, $offset);
     $handler_terminator();
     // cleaning
     return $match;
 }
 public function testAddViewInlineAction()
 {
     $terminateErrorIgnore = \PHPUnit_Util_ErrorHandler::handleErrorOnce(E_USER_DEPRECATED);
     $this->assertFalse($this->listMapper->has('_action'));
     $this->listMapper->add('_action', 'actions', array('actions' => array('view' => array())));
     $this->assertTrue($this->listMapper->has('_action'));
     $fieldDescription = $this->listMapper->get('_action');
     $this->assertInstanceOf('Sonata\\AdminBundle\\Admin\\FieldDescriptionInterface', $fieldDescription);
     $this->assertEquals('_action', $fieldDescription->getName());
     $this->assertCount(1, $fieldDescription->getOption('actions'));
     $this->assertEquals(array('show' => array()), $fieldDescription->getOption('actions'));
     $terminateErrorIgnore();
 }