This commit is contained in:
Nicolas Grekas 2018-09-21 14:44:50 +02:00
parent 5d30df78e7
commit 76c2de0317
6 changed files with 119 additions and 119 deletions

View File

@ -64,10 +64,10 @@ class UndefinedMethodFatalErrorHandlerTest extends TestCase
), ),
array( array(
array( array(
'type' => 1, 'type' => 1,
'message' => 'Call to undefined method class@anonymous::test()', 'message' => 'Call to undefined method class@anonymous::test()',
'file' => '/home/possum/work/symfony/test.php', 'file' => '/home/possum/work/symfony/test.php',
'line' => 11, 'line' => 11,
), ),
'Attempted to call an undefined method named "test" of class "class@anonymous".', 'Attempted to call an undefined method named "test" of class "class@anonymous".',
), ),

View File

@ -936,12 +936,12 @@ class FormTest extends TestCase
{ {
$dom = new \DOMDocument(); $dom = new \DOMDocument();
$dom->loadHTML(' $dom->loadHTML('
<html> <html>
<form> <form>
<textarea name="example"></textarea> <textarea name="example"></textarea>
</form> </form>
</html> </html>'
'); );
$nodes = $dom->getElementsByTagName('form'); $nodes = $dom->getElementsByTagName('form');
$form = new Form($nodes->item(0), 'http://example.com'); $form = new Form($nodes->item(0), 'http://example.com');

View File

@ -29,12 +29,12 @@ class MockSplFileInfo extends \SplFileInfo
parent::__construct($param); parent::__construct($param);
} elseif (\is_array($param)) { } elseif (\is_array($param)) {
$defaults = array( $defaults = array(
'name' => 'file.txt', 'name' => 'file.txt',
'contents' => null, 'contents' => null,
'mode' => null, 'mode' => null,
'type' => null, 'type' => null,
'relativePath' => null, 'relativePath' => null,
'relativePathname' => null, 'relativePathname' => null,
); );
$defaults = array_merge($defaults, $param); $defaults = array_merge($defaults, $param);
parent::__construct($defaults['name']); parent::__construct($defaults['name']);

View File

@ -167,8 +167,8 @@ XML;
public function testEncodeScalarRootAttributes() public function testEncodeScalarRootAttributes()
{ {
$array = array( $array = array(
'#' => 'Paul', '#' => 'Paul',
'@gender' => 'm', '@gender' => 'm',
); );
$expected = '<?xml version="1.0"?>'."\n". $expected = '<?xml version="1.0"?>'."\n".
@ -180,8 +180,8 @@ XML;
public function testEncodeRootAttributes() public function testEncodeRootAttributes()
{ {
$array = array( $array = array(
'firstname' => 'Paul', 'firstname' => 'Paul',
'@gender' => 'm', '@gender' => 'm',
); );
$expected = '<?xml version="1.0"?>'."\n". $expected = '<?xml version="1.0"?>'."\n".
@ -193,7 +193,7 @@ XML;
public function testEncodeCdataWrapping() public function testEncodeCdataWrapping()
{ {
$array = array( $array = array(
'firstname' => 'Paul <or Me>', 'firstname' => 'Paul <or Me>',
); );
$expected = '<?xml version="1.0"?>'."\n". $expected = '<?xml version="1.0"?>'."\n".

View File

@ -42,85 +42,85 @@ class TranslationDataCollectorTest extends TestCase
{ {
$collectedMessages = array( $collectedMessages = array(
array( array(
'id' => 'foo', 'id' => 'foo',
'translation' => 'foo (en)', 'translation' => 'foo (en)',
'locale' => 'en', 'locale' => 'en',
'domain' => 'messages', 'domain' => 'messages',
'state' => DataCollectorTranslator::MESSAGE_DEFINED, 'state' => DataCollectorTranslator::MESSAGE_DEFINED,
'parameters' => array(), 'parameters' => array(),
'transChoiceNumber' => null, 'transChoiceNumber' => null,
), ),
array( array(
'id' => 'bar', 'id' => 'bar',
'translation' => 'bar (fr)', 'translation' => 'bar (fr)',
'locale' => 'fr', 'locale' => 'fr',
'domain' => 'messages', 'domain' => 'messages',
'state' => DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK, 'state' => DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK,
'parameters' => array(), 'parameters' => array(),
'transChoiceNumber' => null, 'transChoiceNumber' => null,
), ),
array( array(
'id' => 'choice', 'id' => 'choice',
'translation' => 'choice', 'translation' => 'choice',
'locale' => 'en', 'locale' => 'en',
'domain' => 'messages', 'domain' => 'messages',
'state' => DataCollectorTranslator::MESSAGE_MISSING, 'state' => DataCollectorTranslator::MESSAGE_MISSING,
'parameters' => array('%count%' => 3), 'parameters' => array('%count%' => 3),
'transChoiceNumber' => 3, 'transChoiceNumber' => 3,
), ),
array( array(
'id' => 'choice', 'id' => 'choice',
'translation' => 'choice', 'translation' => 'choice',
'locale' => 'en', 'locale' => 'en',
'domain' => 'messages', 'domain' => 'messages',
'state' => DataCollectorTranslator::MESSAGE_MISSING, 'state' => DataCollectorTranslator::MESSAGE_MISSING,
'parameters' => array('%count%' => 3), 'parameters' => array('%count%' => 3),
'transChoiceNumber' => 3, 'transChoiceNumber' => 3,
), ),
array( array(
'id' => 'choice', 'id' => 'choice',
'translation' => 'choice', 'translation' => 'choice',
'locale' => 'en', 'locale' => 'en',
'domain' => 'messages', 'domain' => 'messages',
'state' => DataCollectorTranslator::MESSAGE_MISSING, 'state' => DataCollectorTranslator::MESSAGE_MISSING,
'parameters' => array('%count%' => 4, '%foo%' => 'bar'), 'parameters' => array('%count%' => 4, '%foo%' => 'bar'),
'transChoiceNumber' => 4, 'transChoiceNumber' => 4,
), ),
); );
$expectedMessages = array( $expectedMessages = array(
array( array(
'id' => 'foo', 'id' => 'foo',
'translation' => 'foo (en)', 'translation' => 'foo (en)',
'locale' => 'en', 'locale' => 'en',
'domain' => 'messages', 'domain' => 'messages',
'state' => DataCollectorTranslator::MESSAGE_DEFINED, 'state' => DataCollectorTranslator::MESSAGE_DEFINED,
'count' => 1, 'count' => 1,
'parameters' => array(), 'parameters' => array(),
'transChoiceNumber' => null, 'transChoiceNumber' => null,
), ),
array( array(
'id' => 'bar', 'id' => 'bar',
'translation' => 'bar (fr)', 'translation' => 'bar (fr)',
'locale' => 'fr', 'locale' => 'fr',
'domain' => 'messages', 'domain' => 'messages',
'state' => DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK, 'state' => DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK,
'count' => 1, 'count' => 1,
'parameters' => array(), 'parameters' => array(),
'transChoiceNumber' => null, 'transChoiceNumber' => null,
), ),
array( array(
'id' => 'choice', 'id' => 'choice',
'translation' => 'choice', 'translation' => 'choice',
'locale' => 'en', 'locale' => 'en',
'domain' => 'messages', 'domain' => 'messages',
'state' => DataCollectorTranslator::MESSAGE_MISSING, 'state' => DataCollectorTranslator::MESSAGE_MISSING,
'count' => 3, 'count' => 3,
'parameters' => array( 'parameters' => array(
array('%count%' => 3), array('%count%' => 3),
array('%count%' => 3), array('%count%' => 3),
array('%count%' => 4, '%foo%' => 'bar'), array('%count%' => 4, '%foo%' => 'bar'),
), ),
'transChoiceNumber' => 3, 'transChoiceNumber' => 3,
), ),
); );

View File

@ -31,49 +31,49 @@ class DataCollectorTranslatorTest extends TestCase
$expectedMessages = array(); $expectedMessages = array();
$expectedMessages[] = array( $expectedMessages[] = array(
'id' => 'foo', 'id' => 'foo',
'translation' => 'foo (en)', 'translation' => 'foo (en)',
'locale' => 'en', 'locale' => 'en',
'domain' => 'messages', 'domain' => 'messages',
'state' => DataCollectorTranslator::MESSAGE_DEFINED, 'state' => DataCollectorTranslator::MESSAGE_DEFINED,
'parameters' => array(), 'parameters' => array(),
'transChoiceNumber' => null, 'transChoiceNumber' => null,
); );
$expectedMessages[] = array( $expectedMessages[] = array(
'id' => 'bar', 'id' => 'bar',
'translation' => 'bar (fr)', 'translation' => 'bar (fr)',
'locale' => 'fr', 'locale' => 'fr',
'domain' => 'messages', 'domain' => 'messages',
'state' => DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK, 'state' => DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK,
'parameters' => array(), 'parameters' => array(),
'transChoiceNumber' => null, 'transChoiceNumber' => null,
); );
$expectedMessages[] = array( $expectedMessages[] = array(
'id' => 'choice', 'id' => 'choice',
'translation' => 'choice', 'translation' => 'choice',
'locale' => 'en', 'locale' => 'en',
'domain' => 'messages', 'domain' => 'messages',
'state' => DataCollectorTranslator::MESSAGE_MISSING, 'state' => DataCollectorTranslator::MESSAGE_MISSING,
'parameters' => array(), 'parameters' => array(),
'transChoiceNumber' => 0, 'transChoiceNumber' => 0,
); );
$expectedMessages[] = array( $expectedMessages[] = array(
'id' => 'bar_ru', 'id' => 'bar_ru',
'translation' => 'bar (ru)', 'translation' => 'bar (ru)',
'locale' => 'ru', 'locale' => 'ru',
'domain' => 'messages', 'domain' => 'messages',
'state' => DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK, 'state' => DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK,
'parameters' => array(), 'parameters' => array(),
'transChoiceNumber' => null, 'transChoiceNumber' => null,
); );
$expectedMessages[] = array( $expectedMessages[] = array(
'id' => 'bar_ru', 'id' => 'bar_ru',
'translation' => 'bar (ru)', 'translation' => 'bar (ru)',
'locale' => 'ru', 'locale' => 'ru',
'domain' => 'messages', 'domain' => 'messages',
'state' => DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK, 'state' => DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK,
'parameters' => array('foo' => 'bar'), 'parameters' => array('foo' => 'bar'),
'transChoiceNumber' => null, 'transChoiceNumber' => null,
); );
$this->assertEquals($expectedMessages, $collector->getCollectedMessages()); $this->assertEquals($expectedMessages, $collector->getCollectedMessages());