Skip to content

Commit 92aeff5

Browse files
committed
playing with appveyor
1 parent b3647d7 commit 92aeff5

File tree

2 files changed

+154
-140
lines changed

2 files changed

+154
-140
lines changed

appveyor.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,6 @@ install:
5050
- ./vendor/bin/simple-phpunit install
5151

5252
test_script:
53-
- ./vendor/bin/simple-phpunit --group=functional --stop-on-error
54-
- ./vendor/bin/simple-phpunit --exclude-group=functional --stop-on-error
53+
- ./vendor/bin/simple-phpunit --group=functional_group1 --stop-on-error
54+
- ./vendor/bin/simple-phpunit --group=functional_group2 --stop-on-error
55+
- ./vendor/bin/simple-phpunit --exclude-group=functional_group1,functional_group2

tests/Maker/FunctionalTest.php

Lines changed: 151 additions & 138 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@
3434
use Symfony\Component\HttpKernel\Kernel;
3535
use Symfony\Component\Routing\RouteCollectionBuilder;
3636

37-
/**
38-
* @group functional
39-
*/
4037
class FunctionalTest extends MakerTestCase
4138
{
4239
/**
@@ -45,13 +42,26 @@ class FunctionalTest extends MakerTestCase
4542
private $kernel;
4643

4744
/**
45+
* @group functional_group1
4846
* @dataProvider getCommandTests
4947
*/
5048
public function testCommands(MakerTestDetails $makerTestDetails)
5149
{
5250
$this->executeMakerCommand($makerTestDetails);
5351
}
5452

53+
/**
54+
* @group functional_group2
55+
* @dataProvider getCommandEntityTests
56+
*/
57+
public function testEntityCommands(MakerTestDetails $makerTestDetails)
58+
{
59+
// entity tests are split into a different method so we can batch on appveyor
60+
// this solves a weird issue where phpunit would die while running the tests
61+
62+
$this->executeMakerCommand($makerTestDetails);
63+
}
64+
5565
public function getCommandTests()
5666
{
5767
yield 'command' => [MakerTestDetails::createTest(
@@ -138,6 +148,144 @@ public function getCommandTests()
138148
})
139149
];
140150

151+
yield 'fixtures' => [MakerTestDetails::createTest(
152+
$this->getMakerInstance(MakeFixtures::class),
153+
[
154+
'AppFixtures'
155+
])
156+
->assert(function(string $output, string $directory) {
157+
$this->assertContains('created: src/DataFixtures/AppFixtures.php', $output);
158+
})
159+
];
160+
161+
yield 'form' => [MakerTestDetails::createTest(
162+
$this->getMakerInstance(MakeForm::class),
163+
[
164+
// form name
165+
'FooBar',
166+
])
167+
];
168+
169+
yield 'functional' => [MakerTestDetails::createTest(
170+
$this->getMakerInstance(MakeFunctionalTest::class),
171+
[
172+
// functional test class name
173+
'FooBar',
174+
])
175+
->setFixtureFilesPath(__DIR__.'/../fixtures/MakeFunctional')
176+
];
177+
178+
yield 'subscriber' => [MakerTestDetails::createTest(
179+
$this->getMakerInstance(MakeSubscriber::class),
180+
[
181+
// subscriber name
182+
'FooBar',
183+
// event name
184+
'kernel.request',
185+
])
186+
];
187+
188+
yield 'subscriber_unknown_event_class' => [MakerTestDetails::createTest(
189+
$this->getMakerInstance(MakeSubscriber::class),
190+
[
191+
// subscriber name
192+
'FooBar',
193+
// event name
194+
'foo.unknown_event',
195+
])
196+
];
197+
198+
yield 'serializer_encoder' => [MakerTestDetails::createTest(
199+
$this->getMakerInstance(MakeSerializerEncoder::class),
200+
[
201+
// encoder class name
202+
'FooBarEncoder',
203+
// encoder format
204+
'foobar',
205+
])
206+
];
207+
208+
yield 'twig_extension' => [MakerTestDetails::createTest(
209+
$this->getMakerInstance(MakeTwigExtension::class),
210+
[
211+
// extension class name
212+
'FooBar',
213+
])
214+
];
215+
216+
yield 'unit_test' => [MakerTestDetails::createTest(
217+
$this->getMakerInstance(MakeUnitTest::class),
218+
[
219+
// class name
220+
'FooBar',
221+
])
222+
];
223+
224+
yield 'validator' => [MakerTestDetails::createTest(
225+
$this->getMakerInstance(MakeValidator::class),
226+
[
227+
// validator name
228+
'FooBar',
229+
])
230+
];
231+
232+
yield 'voter' => [MakerTestDetails::createTest(
233+
$this->getMakerInstance(MakeVoter::class),
234+
[
235+
// voter class name
236+
'FooBar',
237+
])
238+
];
239+
240+
yield 'auth_empty' => [MakerTestDetails::createTest(
241+
$this->getMakerInstance(MakeAuthenticator::class),
242+
[
243+
// class name
244+
'AppCustomAuthenticator',
245+
])
246+
];
247+
248+
yield 'migration_with_changes' => [MakerTestDetails::createTest(
249+
$this->getMakerInstance(MakeMigration::class),
250+
[/* no input */])
251+
->setFixtureFilesPath(__DIR__.'/../fixtures/MakeMigration')
252+
->configureDatabase(false)
253+
// doctrine-migrations-bundle only requires doctrine-bundle, which
254+
// only requires doctrine/dbal. But we're testing with the ORM,
255+
// so let's install it
256+
->addExtraDependencies('doctrine/orm')
257+
->assert(function(string $output, string $directory) {
258+
$this->assertContains('Success', $output);
259+
260+
$finder = new Finder();
261+
$finder->in($directory.'/src/Migrations')
262+
->name('*.php');
263+
$this->assertCount(1, $finder);
264+
265+
// see that the exact filename is in the output
266+
$iterator = $finder->getIterator();
267+
$iterator->rewind();
268+
$this->assertContains(sprintf('"src/Migrations/%s"', $iterator->current()->getFilename()), $output);
269+
})
270+
];
271+
272+
yield 'migration_no_changes' => [MakerTestDetails::createTest(
273+
$this->getMakerInstance(MakeMigration::class),
274+
[/* no input */])
275+
->setFixtureFilesPath(__DIR__.'/../fixtures/MakeMigration')
276+
->configureDatabase()
277+
// sync the database, so no changes are needed
278+
->addExtraDependencies('doctrine/orm')
279+
->assert(function(string $output, string $directory) {
280+
$this->assertNotContains('Success', $output);
281+
282+
$this->assertContains('No database changes were detected', $output);
283+
})
284+
];
285+
}
286+
287+
public function getCommandEntityTests()
288+
{
141289
yield 'entity_new' => [MakerTestDetails::createTest(
142290
$this->getMakerInstance(MakeEntity::class),
143291
[
@@ -541,141 +689,6 @@ public function getCommandTests()
541689
->setArgumentsString('--overwrite')
542690
->setFixtureFilesPath(__DIR__ . '/../fixtures/MakeEntityOverwrite')
543691
];
544-
545-
yield 'fixtures' => [MakerTestDetails::createTest(
546-
$this->getMakerInstance(MakeFixtures::class),
547-
[
548-
'AppFixtures'
549-
])
550-
->assert(function(string $output, string $directory) {
551-
$this->assertContains('created: src/DataFixtures/AppFixtures.php', $output);
552-
})
553-
];
554-
555-
yield 'form' => [MakerTestDetails::createTest(
556-
$this->getMakerInstance(MakeForm::class),
557-
[
558-
// form name
559-
'FooBar',
560-
])
561-
];
562-
563-
yield 'functional' => [MakerTestDetails::createTest(
564-
$this->getMakerInstance(MakeFunctionalTest::class),
565-
[
566-
// functional test class name
567-
'FooBar',
568-
])
569-
->setFixtureFilesPath(__DIR__.'/../fixtures/MakeFunctional')
570-
];
571-
572-
yield 'subscriber' => [MakerTestDetails::createTest(
573-
$this->getMakerInstance(MakeSubscriber::class),
574-
[
575-
// subscriber name
576-
'FooBar',
577-
// event name
578-
'kernel.request',
579-
])
580-
];
581-
582-
yield 'subscriber_unknown_event_class' => [MakerTestDetails::createTest(
583-
$this->getMakerInstance(MakeSubscriber::class),
584-
[
585-
// subscriber name
586-
'FooBar',
587-
// event name
588-
'foo.unknown_event',
589-
])
590-
];
591-
592-
yield 'serializer_encoder' => [MakerTestDetails::createTest(
593-
$this->getMakerInstance(MakeSerializerEncoder::class),
594-
[
595-
// encoder class name
596-
'FooBarEncoder',
597-
// encoder format
598-
'foobar',
599-
])
600-
];
601-
602-
yield 'twig_extension' => [MakerTestDetails::createTest(
603-
$this->getMakerInstance(MakeTwigExtension::class),
604-
[
605-
// extension class name
606-
'FooBar',
607-
])
608-
];
609-
610-
yield 'unit_test' => [MakerTestDetails::createTest(
611-
$this->getMakerInstance(MakeUnitTest::class),
612-
[
613-
// class name
614-
'FooBar',
615-
])
616-
];
617-
618-
yield 'validator' => [MakerTestDetails::createTest(
619-
$this->getMakerInstance(MakeValidator::class),
620-
[
621-
// validator name
622-
'FooBar',
623-
])
624-
];
625-
626-
yield 'voter' => [MakerTestDetails::createTest(
627-
$this->getMakerInstance(MakeVoter::class),
628-
[
629-
// voter class name
630-
'FooBar',
631-
])
632-
];
633-
634-
yield 'auth_empty' => [MakerTestDetails::createTest(
635-
$this->getMakerInstance(MakeAuthenticator::class),
636-
[
637-
// class name
638-
'AppCustomAuthenticator',
639-
])
640-
];
641-
642-
yield 'migration_with_changes' => [MakerTestDetails::createTest(
643-
$this->getMakerInstance(MakeMigration::class),
644-
[/* no input */])
645-
->setFixtureFilesPath(__DIR__.'/../fixtures/MakeMigration')
646-
->configureDatabase(false)
647-
// doctrine-migrations-bundle only requires doctrine-bundle, which
648-
// only requires doctrine/dbal. But we're testing with the ORM,
649-
// so let's install it
650-
->addExtraDependencies('doctrine/orm')
651-
->assert(function(string $output, string $directory) {
652-
$this->assertContains('Success', $output);
653-
654-
$finder = new Finder();
655-
$finder->in($directory.'/src/Migrations')
656-
->name('*.php');
657-
$this->assertCount(1, $finder);
658-
659-
// see that the exact filename is in the output
660-
$iterator = $finder->getIterator();
661-
$iterator->rewind();
662-
$this->assertContains(sprintf('"src/Migrations/%s"', $iterator->current()->getFilename()), $output);
663-
})
664-
];
665-
666-
yield 'migration_no_changes' => [MakerTestDetails::createTest(
667-
$this->getMakerInstance(MakeMigration::class),
668-
[/* no input */])
669-
->setFixtureFilesPath(__DIR__.'/../fixtures/MakeMigration')
670-
->configureDatabase()
671-
// sync the database, so no changes are needed
672-
->addExtraDependencies('doctrine/orm')
673-
->assert(function(string $output, string $directory) {
674-
$this->assertNotContains('Success', $output);
675-
676-
$this->assertContains('No database changes were detected', $output);
677-
})
678-
];
679692
}
680693

681694
/**

0 commit comments

Comments
 (0)