Skip to content

Commit 0b569ee

Browse files
linawolfjaapio
authored andcommitted
[TASK] Handle bootstrap integration tests via guides.xml
We can get rid of the need of having a separate test class for these test cases
1 parent e9d73aa commit 0b569ee

File tree

39 files changed

+53
-171
lines changed

39 files changed

+53
-171
lines changed

guides.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
xsi:schemaLocation="https://www.phpdoc.org/guides packages/guides-cli/resources/schema/guides.xsd">
55
<project title="phpDocumentor Guides"/>
6-
<html_theme>bootstrap</html_theme>
6+
<theme>bootstrap</theme>
77

88
<extension class="phpDocumentor\Guides\Bootstrap"/>
99
</guides>

packages/guides-cli/resources/schema/guides.xsd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<xsd:element name="extension" type="extension" minOccurs="0" maxOccurs="unbounded"/>
1515
</xsd:choice>
1616

17-
<xsd:attribute name="html_theme" type="xsd:string"/>
17+
<xsd:attribute name="theme" type="xsd:string"/>
1818
</xsd:complexType>
1919

2020
<xsd:complexType name="extension">

packages/guides-cli/src/Command/Run.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,10 +153,10 @@ protected function execute(InputInterface $input, OutputInterface $output): int
153153

154154
$theme = $input->getOption('theme');
155155
if ($theme) {
156-
$settings->setHtmlTheme($theme);
156+
$settings->setTheme($theme);
157157
}
158158

159-
$this->themeManager->useTheme($settings->getHtmlTheme());
159+
$this->themeManager->useTheme($settings->getTheme());
160160

161161
$documents = $this->commandBus->handle(new CompileDocumentsCommand($documents, new CompilerContext($projectNode)));
162162

packages/guides/src/DependencyInjection/GuidesExtension.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function getConfigTreeBuilder(): TreeBuilder
5151
->end()
5252
->end()
5353
->end()
54-
->scalarNode('html_theme')->end()
54+
->scalarNode('theme')->end()
5555
->arrayNode('base_template_paths')
5656
->defaultValue([])
5757
->scalarPrototype()->end()
@@ -104,8 +104,8 @@ public function load(array $configs, ContainerBuilder $container): void
104104
$projectSettings['inventories'] = $config['inventories']['inventory'];
105105
}
106106

107-
if (isset($config['html_theme'])) {
108-
$projectSettings['html_theme'] = (string) $config['html_theme'];
107+
if (isset($config['theme'])) {
108+
$projectSettings['theme'] = (string) $config['theme'];
109109
}
110110

111111
if ($projectSettings) {

packages/guides/src/Settings/ProjectSettings.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ class ProjectSettings
1313
private array $inventories;
1414
private string $title;
1515
private string $version;
16-
private string $htmlTheme;
16+
private string $theme;
1717

1818
/** @param array<string, string|array<string, string>> $settingsArray */
1919
public function __construct(array $settingsArray)
2020
{
2121
$this->title = isset($settingsArray['title']) && is_string($settingsArray['title']) ? $settingsArray['title'] : '';
2222
$this->version = isset($settingsArray['version']) && is_string($settingsArray['version']) ? $settingsArray['version'] : '';
2323
$this->inventories = isset($settingsArray['inventories']) && is_array($settingsArray['inventories']) ? $settingsArray['inventories'] : [];
24-
$this->htmlTheme = isset($settingsArray['html_theme']) && is_string($settingsArray['html_theme']) ? $settingsArray['html_theme'] : 'default';
24+
$this->theme = isset($settingsArray['theme']) && is_string($settingsArray['theme']) ? $settingsArray['theme'] : 'default';
2525
}
2626

2727
public function getTitle(): string
@@ -40,9 +40,9 @@ public function getInventories(): array
4040
return $this->inventories;
4141
}
4242

43-
public function getHtmlTheme(): string
43+
public function getTheme(): string
4444
{
45-
return $this->htmlTheme;
45+
return $this->theme;
4646
}
4747

4848
/** @param array<string, string> $inventories*/
@@ -61,8 +61,8 @@ public function setVersion(string $version): void
6161
$this->version = $version;
6262
}
6363

64-
public function setHtmlTheme(string $htmlTheme): void
64+
public function setTheme(string $theme): void
6565
{
66-
$this->htmlTheme = $htmlTheme;
66+
$this->theme = $theme;
6767
}
6868
}

tests/Integration/IntegrationBootstrapTest.php

Lines changed: 0 additions & 158 deletions
This file was deleted.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<guides xmlns="https://www.phpdoc.org/guides"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="https://www.phpdoc.org/guides packages/guides-cli/resources/schema/guides.xsd">
5+
<theme>bootstrap</theme>
6+
7+
<extension class="phpDocumentor\Guides\Bootstrap"/>
8+
</guides>
File renamed without changes.

0 commit comments

Comments
 (0)