8000 [YAML] Issue #26065 block indentation indicator for some multi-line string literals by tamc · Pull Request #26066 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[YAML] Issue #26065 block indentation indicator for some multi-line string literals #26066

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,15 @@ before_install:
([[ $deps ]] || tfold ext.symfony_debug 'cd src/Symfony/Component/Debug/Resources/ext && phpize && ./configure && make && echo extension = $(pwd)/modules/symfony_debug.so >> '"$INI")
tfold ext.apcu tpecl apcu-4.0.11 apcu.so
elif [[ ! $skip && $PHP = 7.* ]]; then
# install libsodium
if [[ ! -e ~/php-ext/$(php -r "echo basename(ini_get('extension_dir'));")/libsodium/sodium.so ]]; then
sudo add-apt-repository ppa:ondrej/php -y
sudo apt-get update -q
sudo apt-get install libsodium-dev -y
fi

tfold ext.apcu tpecl apcu-5.1.6 apcu.so
tfold ext.libsodium tpecl libsodium sodium.so
tfold ext.mongodb tpecl mongodb-1.4.0RC1 mongodb.so
fi

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
security:
encoders:
JMS\FooBundle\Entity\User6:
JMS\FooBundle\Entity\User7:
algorithm: argon2i

providers:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public function testEncodePasswordArgon2i()
$this->assertContains('Password encoding succeeded', $output);

$encoder = new Argon2iPasswordEncoder();
preg_match('# Encoded password\s+(\$argon2i\$[\w\d,=\$+\/]+={0,2})\s+#', $output, $matches);
preg_match('# Encoded password\s+(\$argon2id\$[\w\d,=\$+\/]+={0,2})\s+#', $output, $matches);
$hash = $matches[1];
$this->assertTrue($encoder->isPasswordValid($hash, 'password', null));
}
Expand Down Expand Up @@ -272,7 +272,7 @@ protected function tearDown()
private function setupArgon2i()
{
putenv('COLUMNS='.(119 + strlen(PHP_EOL)));
$kernel = $this->createKernel(array('test_case' => 'PasswordEncode', 'root_config' => 'argon2i'));
$kernel = $this->createKernel(array('test_case' => 'PasswordEncode', 'root_config' => 'argon2i.yml'));
$kernel->boot();

$application = new Application($kernel);
Expand Down
8000
7 changes: 4 additions & 3 deletions src/Symfony/Component/HttpKernel/Tests/ClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,16 @@ public function testFilterResponseSupportsStreamedResponses()
public function testUploadedFile()
{
$source = tempnam(sys_get_temp_dir(), 'source');
file_put_contents($source, '1');
$target = sys_get_temp_dir().'/sf.moved.file';
@unlink($target);

$kernel = new TestHttpKernel();
$client = new Client($kernel);

$files = array(
array('tmp_name' => $source, 'name' => 'original', 'type' => 'mime/original', 'size' => 123, 'error' => UPLOAD_ERR_OK),
new UploadedFile($source, 'original', 'mime/original', 123, UPLOAD_ERR_OK, true),
array('tmp_name' => $source, 'name' => 'original', 'type' => 'mime/original', 'size' => 1, 'error' => UPLOAD_ERR_OK),
new UploadedFile($source, 'original', 'mime/original', 1, UPLOAD_ERR_OK, true),
);

$file = null;
Expand All @@ -120,7 +121,7 @@ public function testUploadedFile()

$this->assertEquals('original', $file->getClientOriginalName());
$this->assertEquals('mime/original', $file->getClientMimeType());
$this->assertEquals('123', $file->getClientSize());
$this->assertSame(1, $file->getClientSize());
$this->assertTrue($file->isValid());
}

Expand Down
77 changes: 11 additions & 66 deletions src/Symfony/Component/Yaml/Tests/DumperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,35 +77,6 @@ public function testIndentationInConstructor()
$this->assertEquals($expected, $dumper->dump($this->array, 4, 0));
}

/**
* @group legacy
*/
public function testSetIndentation()
{
$this->dumper->setIndentation(7);

$expected = <<<'EOF'
'': bar
foo: '#bar'
'foo''bar': { }
bar:
- 1
- foo
foobar:
foo: bar
bar:
- 1
- foo
foobar:
foo: bar
bar:
- 1
- foo

EOF;
$this->assertEquals($expected, $this->dumper->dump($this->array, 4, 0));
}

public function testSpecifications()
{
$files = $this->parser->parse(file_get_contents($this->path.'/index.yml'));
Expand Down Expand Up @@ -213,16 +184,6 @@ public function testObjectSupportEnabled()
$this->assertEquals('{ foo: !php/object \'O:30:"Symfony\Component\Yaml\Tests\A":1:{s:1:"a";s:3:"foo";}\', bar: 1 }', $dump, '->dump() is able to dump objects');
}

/**
* @group legacy
*/
public function testObjectSupportEnabledPassingTrue()
{
$dump = $this->dumper->dump(array('foo' => new A(), 'bar' => 1), 0, 0, false, true);

$this->assertEquals('{ foo: !php/object \'O:30:"Symfony\Component\Yaml\Tests\A":1:{s:1:"a";s:3:"foo";}\', bar: 1 }', $dump, '->dump() is able to dump objects');
}

public function testObjectSupportDisabledButNoExceptions()
{
$dump = $this->dumper->dump(array('foo' => new A(), 'bar' => 1));
Expand All @@ -238,33 +199,6 @@ public function testObjectSupportDisabledWithExceptions()
$this->dumper->dump(array('foo' => new A(), 'bar' => 1), 0, 0, Yaml::DUMP_EXCEPTION_ON_INVALID_TYPE);
}

/**
* @group legacy
* @expectedException \Symfony\Component\Yaml\Exception\DumpException
*/
public function testObjectSupportDisabledWithExceptionsPassingTrue()
{
$this->dumper->dump(array('foo' => new A(), 'bar' => 1), 0, 0, true);
}

public function testEmptyArray()
{
$dump = $this->dumper->dump(array());
$this->assertEquals('{ }', $dump);

$dump = $this->dumper->dump(array(), 0, 0, Yaml::DUMP_EMPTY_ARRAY_AS_SEQUENCE);
$this->assertEquals('[]', $dump);

$dump = $this->dumper->dump(array(), 9, 0, Yaml::DUMP_EMPTY_ARRAY_AS_SEQUENCE);
$this->assertEquals('[]', $dump);

$dump = $this->dumper->dump(new \ArrayObject(), 0, 0, Yaml::DUMP_EMPTY_ARRAY_AS_SEQUENCE | Yaml::DUMP_OBJECT_AS_MAP);
$this->assertEquals('{ }', $dump);

$dump = $this->dumper->dump(new \stdClass(), 0, 0, Yaml::DUMP_EMPTY_ARRAY_AS_SEQUENCE | Yaml::DUMP_OBJECT_AS_MAP);
$this->assertEquals('{ }', $dump);
}

/**
* @dataProvider getEscapeSequences
*/
Expand Down Expand Up @@ -454,6 +388,17 @@ public function testDumpMultiLineStringAsScalarBlock()
$this->assertSame(file_get_contents(__DIR__.'/Fixtures/multiple_lines_as_literal_block.yml'), $this->dumper->dump($data, 2, 0, Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK));
}

public function testDumpMultiLineStringAsScalarBlockWhenFirstLineHasLeadingSpace()
{
$data = array(
'data' => array(
'multi_line' => " the first line has leading spaces\nThe second line does not.",
),
);

$this->assertSame(file_get_contents(__DIR__.'/Fixtures/multiple_lines_as_literal_block_leading_space_in_first_line.yml'), $this->dumper->dump($data, 2, 0, Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK));
}

public function testCarriageReturnIsMaintainedWhenDumpingAsMultiLineLiteralBlock()
{
$this->assertSame("- \"a\\r\\nb\\nc\"\n", $this->dumper->dump(array("a\r\nb\nc"), 2, 0, Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK));
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
data:
multi_line: |4
the first line has leading spaces
The second line does not.
0