10000 Make convert services · Pull Request #604 · symfony/maker-bundle · GitHub
[go: up one dir, main page]

Skip to content

Make convert services #604

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 31 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
1f3022f
Adding command to convert service yaml files to php
May 12, 2020
4f77ceb
adding an argument to control the filename
weaverryan Jun 12, 2020
668cd3f
helping edit know specifically which class is returned
weaverryan Jun 12, 2020
a02f9f2
re-adding Symfony 5.1 requirement
weaverryan Jun 12, 2020
b7201c5
improving the test
weaverryan Jun 12, 2020
9e1c4aa
Adding bigger closing statement, including warning if your kernel doe…
weaverryan Jun 12, 2020
52b4191
fixing some misspellings
weaverryan Jun 12, 2020
027f969
adding test case for new deprecated syntax in 5.
weaverryan Jun 12, 2020
880d83e
minor clarification about argument name
weaverryan Jun 12, 2020
6853a09
convert exceptions from conversion into the nicer command exceptions
weaverryan Jun 12, 2020
f791e72
moving the handling of whether or not the container should be tested …
weaverryan Jun 12, 2020
11198df
this file is already tested in the main method
weaverryan Jun 12, 2020
579b780
renaming directory
weaverryan Jun 12, 2020
9f488be
I don't see why we're skipping someFile.yaml
weaverryan Jun 12, 2020
9ae90ea
just renaming files - I'll move them in a minute
weaverryan Jun 12, 2020
b5528be
Fixing a bug in the test
weaverryan Jun 12, 2020
b0f0b17
moving the reosource tests into the main test case
weaverryan Jun 12, 2020
9b247e2
combining last method into the main one
weaverryan Jun 12, 2020
a279dc9
Refactoring how we handle service args to be very specific
weaverryan Jun 12, 2020
0c23a34
updating for last-second php 5.1 changes: ref() -> service()
weaverryan Jun 12, 2020
2a9c9e3
removing bad error - this IS in fact a bad YAML situation
weaverryan Jun 12, 2020
73fde10
skipping tests below symfony 5.1
weaverryan Jun 12, 2020
50ea730
fixing php 7.1 syntax error
10000 weaverryan Jun 12, 2020
18b3ad2
fixing phpcs
weaverryan Jun 12, 2020
f785aeb
adding support for exclude as an array
weaverryan Jul 10, 2020
45c3585
adding state to PhpServicesCreator in prep for environments handling
weaverryan Jul 10, 2020
f30affd
Revert "adding state to PhpServicesCreator in prep for environments h…
weaverryan Jul 10, 2020
60aadd5
adding support for converting all services files at the same time (fo…
weaverryan Jul 10, 2020
d8f12c7
avoiding state problem and fixing "main" -> "all"
weaverryan Jul 10, 2020
098295e
Bringing in changes from https://github.com/migrify/migrify
weaverryan Jul 10, 2020
5033a64
fixing expected variable
weaverryan Jul 13, 2020
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
Prev Previous commit
Next Next commit
moving the handling of whether or not the container should be tested …
…to the data provider

The data provider should, ideally, pass all the info the tests needs directly. So,
let's directly tell the test case if the container should be compared or not
  • Loading branch information
weaverryan committed Jul 10, 2020
commit f791e72a57c9f56fcb33a6ab810dcdb13331ef70
21 changes: 11 additions & 10 deletions tests/Util/PhpServicesCreatorTest.php
< 9079 tr data-hunk="bde03998840683b74eb0243bf9f9bcb6364197ee794924f8fbc75cecaaf5b832" class="show-top-border">
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,12 @@ class PhpServicesCreatorTest extends TestCase
/**
* @dataProvider getConfigurationFiles
*/
public function testYamlServicesConversion(string $yamlSource, string $phpExpectedSource, string $filename)
public function testYamlServicesConversion(string $yamlSource, string $phpExpectedSource, bool $shouldCompareContainers)
{
$creator = new PhpServicesCreator();
$this->assertSame($phpExpectedSource, $creator->convert($yamlSource));
/*
* test if default comments and configuration in services_load_resources.yaml are successfully converted in php but
* resources "app\", "App\Controller" can't be loaded in this context, then services_load_resources.yaml and
* services_load_resources.php building are tested with other fake resources by the testFixturesLoad() method above.
*/
if ('services_load_resources' !== $filename) {

if ($shouldCompareContainers) {
list($tmpYamlFilename, $tmpPhpFilename) = $this->createTemporaryFiles($yamlSource, $phpExpectedSource);
$this->compareContainers($tmpYamlFilename, $tmpPhpFilename);
$this->removeTemporaryFiles($tmpYamlFilename, $tmpPhpFilename);
Expand All @@ -54,13 +50,18 @@ public function getConfigurationFiles()
->in(self::YAML_PHP_CONVERT_FIXTURES_PATH.'/source_yaml');

foreach ($finder as $key => $file) {
$filename = $file->getFilenameWithoutExtension();
$phpExpectedRealPath = str_replace(['source_yaml', '.yaml'], ['expected_php', '.php'], $file->getRealPath());

yield $filename => [
$shouldCompareContainers = true;
// this file loads "resources", which will fail as there are no real files
if ($file->getFilename() === 'services_load_resources.yaml') {
$shouldCompareContainers = false;
}

yield $file->getFilenameWithoutExtension() => [
$file->getContents(),
file_get_contents($phpExpectedRealPath),
$filename,
$shouldCompareContainers,
];
}
}
Expand Down
0