Skip to content

Commit a1313b7

Browse files
committed
fix tests
1 parent c2ccc64 commit a1313b7

File tree

5 files changed

+11
-24
lines changed

5 files changed

+11
-24
lines changed

src/Command/CommandInitializerTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ function ($file) use ($outputDir, $format) {
202202

203203
private function isCacheDisabled(): bool
204204
{
205-
return (bool) $this->input->getOption('disable-cache');
205+
return $this->input->hasOption('disable-cache') && (bool) $this->input->getOption('disable-cache');
206206
}
207207

208208
public function postParseDocument(PostParseDocumentEvent $postParseDocumentEvent): void

tests/Command/BuildDocsCommandTest.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212

1313
class BuildDocsCommandTest extends TestCase
1414
{
15-
public function testBuildDocs()
15+
public function testBuildDocs1()
1616
{
17-
$buildContext = $this->createParameterBag();
17+
$buildContext = $this->createBuildContext();
1818
$outputDir = sprintf('%s/tests/_output', $buildContext->getBasePath());
1919

2020
$output = $this->executeCommand(
@@ -25,7 +25,6 @@ public function testBuildDocs()
2525
]
2626
);
2727

28-
$this->assertEquals(1, substr_count($output, '[WARNING]'));
2928
$this->assertContains('[OK] Parse process complete', $output);
3029

3130
$filesystem = new Filesystem();
@@ -34,7 +33,7 @@ public function testBuildDocs()
3433

3534
public function testBuildDocsForPdf()
3635
{
37-
$buildContext = $this->createParameterBag();
36+
$buildContext = $this->createBuildContext();
3837
$outputDir = sprintf('%s/tests/_output', $buildContext->getBasePath());
3938

4039
$output = $this->executeCommand(
@@ -46,8 +45,6 @@ public function testBuildDocsForPdf()
4645
]
4746
);
4847

49-
$this->assertNotContains('[WARNING]', $output);
50-
5148
$filesystem = new Filesystem();
5249
$this->assertTrue($filesystem->exists(sprintf('%s/_images/symfony-logo.png', $outputDir)));
5350
$this->assertTrue($filesystem->exists(sprintf('%s/book.html', $outputDir)));
@@ -79,7 +76,7 @@ private function executeCommand(BuildContext $buildContext, array $input): strin
7976
return $commandTester->getDisplay();
8077
}
8178

82-
private function createParameterBag(): BuildContext
79+
private function createBuildContext(): BuildContext
8380
{
8481
$buildContext = new BuildContext(
8582
realpath(__DIR__.'/../..'),

tests/IntegrationTest.php

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ public function testIntegration(string $folder)
3232
$fs = new Filesystem();
3333
$fs->remove(__DIR__.'/_output');
3434

35-
$configBag = $this->createParameterBag(sprintf('%s/fixtures/source/%s', __DIR__, $folder));
35+
$buildContext = $this->createBuildContext(sprintf('%s/fixtures/source/%s', __DIR__, $folder));
3636

3737
$builder = new Builder(
38-
KernelFactory::createKernel($configBag)
38+
KernelFactory::createKernel($buildContext)
3939
);
4040

4141
$builder->build(
@@ -62,12 +62,8 @@ public function testIntegration(string $folder)
6262
);
6363
}
6464

65-
$jsonGenerator = new JsonGenerator();
66-
$jsonGenerator->generateJson(
67-
$builder->getDocuments()->getAll(),
68-
$configBag,
69-
new ProgressBar(new NullOutput())
70-
);
65+
$jsonGenerator = new JsonGenerator($buildContext);
66+
$jsonGenerator->generateJson($builder->getDocuments()->getAll(), new ProgressBar(new NullOutput()));
7167

7268
foreach ($finder as $htmlFile) {
7369
$relativePath = $htmlFile->getRelativePathname();
@@ -113,7 +109,7 @@ public function testParseUnitBlock(string $blockName)
113109
$configuration->setCustomTemplateDirs([__DIR__.'/Templates']);
114110

115111
$parser = new Parser(
116-
KernelFactory::createKernel($this->createParameterBag(sprintf('%s/fixtures/source/blocks', __DIR__)))
112+
KernelFactory::createKernel($this->createBuildContext(sprintf('%s/fixtures/source/blocks', __DIR__)))
117113
);
118114

119115
$sourceFile = sprintf('%s/fixtures/source/blocks/%s.rst', __DIR__, $blockName);
@@ -268,7 +264,7 @@ public function parserUnitBlockProvider()
268264
];
269265
}
270266

271-
private function createParameterBag(string $sourceDir): BuildContext
267+
private function createBuildContext(string $sourceDir): BuildContext
272268
{
273269
$buildContext = new BuildContext(
274270
realpath(__DIR__.'/..'),

tests/fixtures/source/main/orphan1.rst

Lines changed: 0 additions & 4 deletions
This file was deleted.

tests/fixtures/source/main/orphan2.rst

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)