Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6bfc082

Browse files
committed
feature #26698 [Console] Use UTF-8 bullet for listing (ro0NL)
This PR was squashed before being merged into the 4.1-dev branch (closes #26698). Discussion ---------- [Console] Use UTF-8 bullet for listing | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no <!-- see https://symfony.com/bc --> | Deprecations? | no | Tests pass? | yes | Fixed tickets | #... <!-- #-prefixed issue number(s), if any --> | License | MIT | Doc PR | symfony/symfony-docs#... <!-- required for new features --> Inspired by the new table style, this updates the listing style. before ![image](https://user-images.githubusercontent.com/1047696/38031214-019c79f4-329b-11e8-8352-9453c7ccc129.png) after ![image](https://user-images.githubusercontent.com/1047696/38031186-ed8b1e66-329a-11e8-8538-2256a0e24a42.png) Commits ------- d1e4acb [Console] Use UTF-8 bullet for listing
2 parents 9b25573 + d1e4acb commit 6bfc082

File tree

14 files changed

+146
-19
lines changed

14 files changed

+146
-19
lines changed

src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/AbstractDescriptorTest.php

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ private function getDescriptionTestData(array $objects)
203203
{
204204
$data = array();
205205
foreach ($objects as $name => $object) {
206-
$description = file_get_contents(sprintf('%s/../../Fixtures/Descriptor/%s.%s', __DIR__, $name, $this->getFormat()));
206+
$description = file_get_contents($this->getFixtureFilename($name));
207207
$data[] = array($object, $description);
208208
}
209209

@@ -223,7 +223,7 @@ private function getContainerBuilderDescriptionTestData(array $objects)
223223
$data = array();
224224
foreach ($objects as $name => $object) {
225225
foreach ($variations as $suffix => $options) {
226-
$description = file_get_contents(sprintf('%s/../../Fixtures/Descriptor/%s_%s.%s', __DIR__, $name, $suffix, $this->getFormat()));
226+
$description = file_get_contents($this->getFixtureFilename($name.'_'.$suffix));
227227
$data[] = array($object, $description, $options);
228228
}
229229
}
@@ -241,11 +241,23 @@ private function getEventDispatcherDescriptionTestData(array $objects)
241241
$data = array();
242242
foreach ($objects as $name => $object) {
243243
foreach ($variations as $suffix => $options) {
244-
$description = file_get_contents(sprintf('%s/../../Fixtures/Descriptor/%s_%s.%s', __DIR__, $name, $suffix, $this->getFormat()));
244+
$description = file_get_contents($this->getFixtureFilename($name.'_'.$suffix));
245245
$data[] = array($object, $description, $options);
246246
}
247247
}
248248

249249
return $data;
250250
}
251+
252+
private function getFixtureFilename($name)
253+
{
254+
$format = $this->getFormat();
255+
$baseDir = __DIR__.'/../../Fixtures/Descriptor';
256+
$file = $baseDir.'/'.$name.'.'.$format;
257+
if ('\\' === DIRECTORY_SEPARATOR && is_file($winFile = $baseDir.'/win/'.$name.'.'.$format)) {
258+
return $winFile;
259+
}
260+
261+
return $file;
262+
}
251263
}

src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tags.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
"tag1" tag
66
----------
77

8-
* definition_2
8+
definition_2
99

1010
"tag2" tag
1111
----------
1212

13-
* definition_2
13+
definition_2
1414

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
2+
Symfony Container Public and Private Tags
3+
=========================================
4+
5+
"tag1" tag
6+
----------
7+
8+
* definition_2
9+
10+
"tag2" tag
11+
----------
12+
13+
* definition_2
14+

src/Symfony/Component/Console/Style/SymfonyStyle.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public function listing(array $elements)
103103
{
104104
$this->autoPrependText();
105105
$elements = array_map(function ($element) {
106-
return sprintf(' * %s', $element);
106+
return sprintf(' %s %s', '\\' === DIRECTORY_SEPARATOR ? '*' : '', $element);
107107
}, $elements);
108108

109109
$this->writeln($elements);

src/Symfony/Component/Console/Tests/Fixtures/Style/SymfonyStyle/output/output_5.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
Lorem ipsum dolor sit amet
2-
* Lorem ipsum dolor sit amet
3-
* consectetur adipiscing elit
2+
Lorem ipsum dolor sit amet
3+
consectetur adipiscing elit
44

55
Lorem ipsum dolor sit amet
6-
* Lorem ipsum dolor sit amet
7-
* consectetur adipiscing elit
6+
Lorem ipsum dolor sit amet
7+
consectetur adipiscing elit
88

99
Lorem ipsum dolor sit amet
1010
Lorem ipsum dolor sit amet
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

2-
* Lorem ipsum dolor sit amet
3-
* consectetur adipiscing elit
2+
Lorem ipsum dolor sit amet
3+
consectetur adipiscing elit
44

55
[OK] Lorem ipsum dolor sit amet
66

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
Lorem ipsum dolor sit amet
2+
* Lorem ipsum dolor sit amet
3+
* consectetur adipiscing elit
4+
5+
Lorem ipsum dolor sit amet
6+
* Lorem ipsum dolor sit amet
7+
* consectetur adipiscing elit
8+
9+
Lorem ipsum dolor sit amet
10+
Lorem ipsum dolor sit amet
11+
consectetur adipiscing elit
12+
13+
Lorem ipsum dolor sit amet
14+
15+
// Lorem ipsum dolor sit amet
16+
//
17+
// consectetur adipiscing elit
18+
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
* Lorem ipsum dolor sit amet
3+
* consectetur adipiscing elit
4+
5+
[OK] Lorem ipsum dolor sit amet
6+

src/Symfony/Component/Console/Tests/Style/SymfonyStyleTest.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,15 @@ public function inputCommandToOutputFilesProvider()
7474
{
7575
$baseDir = __DIR__.'/../Fixtures/Style/SymfonyStyle';
7676

77-
return array_map(null, glob($baseDir.'/command/command_*.php'), glob($baseDir.'/output/output_*.txt'));
77+
return array_map(function ($cmd) use ($baseDir) {
78+
$basename = 'output_'.substr(basename($cmd, '.php'), 8).'.txt';
79+
$output = $baseDir.'/output/'.$basename;
80+
if ('\\' === \DIRECTORY_SEPARATOR && is_file($outputWin = $baseDir.'/output/win/'.$basename)) {
81+
return array($cmd, $outputWin);
82+
}
83+
84+
return array($cmd, $output);
85+
}, glob($baseDir.'/command/command_*.php'));
7886
}
7987

8088
public function testGetErrorStyle()

src/Symfony/Component/Form/Tests/Console/Descriptor/AbstractDescriptorTest.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,14 @@ private function getExpectedDescription($name)
127127

128128
private function getFixtureFilename($name)
129129
{
130-
return sprintf('%s/../../Fixtures/Descriptor/%s.%s', __DIR__, $name, $this->getFormat());
130+
$format = $this->getFormat();
131+
$baseDir = __DIR__.'/../../Fixtures/Descriptor';
132+
$file = $baseDir.'/'.$name.'.'.$format;
133+
if ('\\' === DIRECTORY_SEPARATOR && is_file($winFile = $baseDir.'/win/'.$name.'.'.$format)) {
134+
return $winFile;
135+
}
136+
137+
return $file;
131138
}
132139
}
133140

src/Symfony/Component/Form/Tests/Fixtures/Descriptor/defaults_1.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ Built-in form types (Symfony\Component\Form\Extension\Core\Type)
77
Service form types
88
------------------
99

10-
* Symfony\Bridge\Doctrine\Form\Type\EntityType
10+
Symfony\Bridge\Doctrine\Form\Type\EntityType
1111

1212
Type extensions
1313
---------------
1414

15-
* Symfony\Component\Form\Extension\Csrf\Type\FormTypeCsrfExtension
15+
Symfony\Component\Form\Extension\Csrf\Type\FormTypeCsrfExtension
1616

1717
Type guessers
1818
-------------
1919

20-
* Symfony\Component\Form\Extension\Validator\ValidatorTypeGuesser
20+
Symfony\Component\Form\Extension\Validator\ValidatorTypeGuesser
2121

src/Symfony/Component/Form/Tests/Fixtures/Descriptor/resolved_form_type_1.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ Symfony\Component\Form\Extension\Core\Type\ChoiceType (Block prefix: "choice")
3232
Parent types
3333
------------
3434

35-
* Symfony\Component\Form\Extension\Core\Type\FormType
35+
Symfony\Component\Form\Extension\Core\Type\FormType
3636

3737
Type extensions
3838
---------------
3939

40-
* Symfony\Component\Form\Extension\Csrf\Type\FormTypeCsrfExtension
40+
Symfony\Component\Form\Extension\Csrf\Type\FormTypeCsrfExtension
4141

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2+
Built-in form types (Symfony\Component\Form\Extension\Core\Type)
3+
----------------------------------------------------------------
4+
5+
FormType
6+
7+
Service form types
8+
------------------
9+
10+
* Symfony\Bridge\Doctrine\Form\Type\EntityType
11+
12+
Type extensions
13+
---------------
14+
15+
* Symfony\Component\Form\Extension\Csrf\Type\FormTypeCsrfExtension
16+
17+
Type guessers
18+
-------------
19+
20+
* Symfony\Component\Form\Extension\Validator\ValidatorTypeGuesser
21+
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
2+
Symfony\Component\Form\Extension\Core\Type\ChoiceType (Block prefix: "choice")
3+
==============================================================================
4+
5+
--------------------------- -------------------- ------------------------- -----------------------
6+
Options Overridden options Parent options Extension options
7+
--------------------------- -------------------- ------------------------- -----------------------
8+
choice_attr FormType FormType FormTypeCsrfExtension
9+
choice_label -------------------- ------------------------- -----------------------
10+
choice_loader compound action csrf_field_name
11+
choice_name data_class attr csrf_message
12+
choice_translation_domain empty_data auto_initialize csrf_protection
13+
choice_value error_bubbling block_name csrf_token_id
14+
choices by_reference csrf_token_manager
15+
expanded data
16+
group_by disabled
17+
multiple help
18+
placeholder inherit_data
19+
preferred_choices label
20+
label_attr
21+
label_format
22+
mapped
23+
method
24+
post_max_size_message
25+
property_path
26+
required
27+
translation_domain
28+
trim
29+
upload_max_size_message
30+
--------------------------- -------------------- ------------------------- -----------------------
31+
32+
Parent types
33+
------------
34+
35+
* Symfony\Component\Form\Extension\Core\Type\FormType
36+
37+
Type extensions
38+
---------------
39+
40+
* Symfony\Component\Form\Extension\Csrf\Type\FormTypeCsrfExtension
41+

0 commit comments

Comments
 (0)