Skip to content

Commit 42d98b5

Browse files
committed
fixing tests
1 parent f4bc17c commit 42d98b5

File tree

10 files changed

+67
-60
lines changed

10 files changed

+67
-60
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/vendor/
22
/tests/_output
3+
/tests/_cache
34
/var/
45
/docs.phar

src/BuildContext.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ class BuildContext
1414
private $outputDir;
1515
private $parseSubPath;
1616
private $disableCache = false;
17+
private $cacheDirectory;
1718

1819
public function __construct(
1920
string $symfonyVersion,
@@ -86,7 +87,12 @@ public function getDisableCache(): bool
8687

8788
public function getCacheDir(): string
8889
{
89-
return $this->getSourceDir().'/.cache';
90+
return $this->cacheDirectory ?: $this->getOutputDir().'/.cache';
91+
}
92+
93+
public function setCacheDirectory(string $cacheDirectory)
94+
{
95+
$this->cacheDirectory = $cacheDirectory;
9096
}
9197

9298
private function checkThatRuntimeConfigIsInitialized()
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
{% spaceless %}
1+
{% apply spaceless %}
22
{% set domElement = attributes.domElement|default %}
33
{% set class = (attributes.class|default ? attributes.class ~ ' ' : '') ~ 'reference ' ~ (('://' in url) ? 'external' : 'internal') %}
44
<a href="{{ url|raw }}" class="{{ class }}"{% for key, value in attributes if key != 'domElement' and key != 'class' %} {{ key }}="{{ value }}"{% endfor %}>{% if domElement %}<{{ domElement }}>{% endif %}{{ title|raw }}{% if domElement %}</{{ domElement }}>{% endif %}</a>
5-
{% endspaceless %}
5+
{% endapply %}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
{% spaceless %}
1+
{% apply spaceless %}
22
<ul>
33
{% for tocItem in tocItems %}
44
{% include "toc-item.html.twig" %}
55
{% endfor %}
66
</ul>
7-
{% endspaceless %}
7+
{% endapply %}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
{% spaceless %}
1+
{% apply spaceless %}
22
<div class="toctree-wrapper compound">
33
{% include "toc-level.html.twig" %}
44
</div>
5-
{% endspaceless %}
5+
{% endapply %}

tests/Command/BuildDocsCommandTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public function testBuildDocsFoo()
2424
$output = $this->executeCommand(
2525
$buildContext,
2626
[
27-
'source-dir' => __DIR__.'/../tests/fixtures/source/main',
27+
'source-dir' => __DIR__.'/../fixtures/source/main',
2828
'output-dir' => $outputDir,
2929
]
3030
);
@@ -36,7 +36,7 @@ public function testBuildDocsFoo()
3636
$output = $this->executeCommand(
3737
$buildContext,
3838
[
39-
'source-dir' => __DIR__.'/../tests/fixtures/source/main',
39+
'source-dir' => __DIR__.'/../fixtures/source/main',
4040
'output-dir' => $outputDir,
4141
]
4242
);

tests/IntegrationTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,6 @@ public function parserUnitBlockProvider()
277277
private function createBuildContext(string $sourceDir): BuildContext
278278
{
279279
$buildContext = new BuildContext(
280-
realpath(__DIR__.'/..'),
281280
'4.0',
282281
'https://api.symfony.com/4.0',
283282
'https://secure.php.net/manual/en',
@@ -288,6 +287,7 @@ private function createBuildContext(string $sourceDir): BuildContext
288287
__DIR__.'/_output',
289288
null
290289
);
290+
$buildContext->setCacheDirectory(__DIR__.'/_cache');
291291

292292
return $buildContext;
293293
}

tests/fixtures/expected/blocks/nodes/tables.html

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -4,76 +4,76 @@
44
<meta charset="utf-8" />
55
</head>
66
<body>
7-
<table class="docutils" border="1">
8-
<thead valign="bottom">
9-
<tr class="row-odd">
10-
<th class="head">Route path</th>
11-
<th class="head">If the requested URL is /foo</th>
12-
<th class="head">If the requested URL is /foo/</th>
7+
<table>
8+
<thead>
9+
<tr>
10+
<th>Route path</th>
11+
<th>If the requested URL is /foo</th>
12+
<th>If the requested URL is /foo/</th>
1313
</tr>
1414
</thead>
15-
<tbody valign="top">
16-
<tr class="row-even">
15+
<tbody>
16+
<tr>
1717
<td>/foo</td>
1818
<td>It matches (200 status response)</td>
1919
<td>It doesn't match (404 status response)</td>
2020
</tr>
21-
<tr class="row-odd">
21+
<tr>
2222
<td>/foo/</td>
2323
<td>It makes a 301 redirect to /foo/</td>
2424
<td>It matches (200 status response)</td>
2525
</tr>
2626
</tbody>
2727
</table>
28-
<table class="docutils" border="1">
29-
<tbody valign="top">
30-
<tr class="row-odd">
28+
<table>
29+
<tbody>
30+
<tr>
3131
<td>Cell 1</td>
3232
<td>Cell 2</td>
3333
</tr>
34-
<tr class="row-even">
34+
<tr>
3535
<td>Cell 3</td>
3636
<td>Cell 4</td>
3737
</tr>
38-
<tr class="row-odd">
38+
<tr>
3939
<td>Cell 5</td>
4040
<td>Cell 6
4141
extra line</td>
4242
</tr>
4343
</tbody>
4444
</table>
45-
<table class="docutils" border="1">
46-
<thead valign="bottom">
47-
<tr class="row-odd">
48-
<th class="head">Cell 1</th>
49-
<th class="head">Cell 2</th>
45+
<table>
46+
<thead>
47+
<tr>
48+
<th>Cell 1</th>
49+
<th>Cell 2</th>
5050
</tr>
5151
</thead>
52-
<tbody valign="top">
53-
<tr class="row-even">
52+
<tbody>
53+
<tr>
5454
<td>Cell 3</td>
5555
<td>Cell 4</td>
5656
</tr>
57-
<tr class="row-odd">
57+
<tr>
5858
<td>Cell 5</td>
5959
<td>Cell 6
6060
extra line</td>
6161
</tr>
6262
</tbody>
6363
</table>
64-
<table class="docutils" border="1">
65-
<thead valign="bottom">
66-
<tr class="row-odd">
67-
<th class="head">Cell 1</th>
68-
<th class="head">Cell 2</th>
64+
<table>
65+
<thead>
66+
<tr>
67+
<th>Cell 1</th>
68+
<th>Cell 2</th>
6969
</tr>
7070
</thead>
71-
<tbody valign="top">
72-
<tr class="row-even">
71+
<tbody>
72+
<tr>
7373
<td>Cell 3</td>
7474
<td>Cell 4</td>
7575
</tr>
76-
<tr class="row-odd">
76+
<tr>
7777
<td>Cell 5</td>
7878
<td>
7979
<ul>
@@ -84,7 +84,7 @@
8484
</ul>
8585
</td>
8686
</tr>
87-
<tr class="row-even">
87+
<tr>
8888
<td>Cell 7</td>
8989
<td>Cell 8</td>
9090
</tr>

tests/fixtures/expected/main/datetime.html

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@ <h1>DateTimeType Field<a class="headerlink" href="#datetimetype-field" title="Pe
99

1010
<p>This field type allows the user to modify data that represents a specific
1111
date and time (e.g. <code>1984-06-05 12:15:30</code>).</p>
12-
<table class="docutils" border="1">
13-
<tbody valign="top">
14-
<tr class="row-odd">
12+
<table>
13+
<tbody>
14+
<tr>
1515
<td>Underlying Data Type</td>
1616
<td>can be <code>DateTime</code>, string, timestamp, or array (see the <code>input</code> option)</td>
1717
</tr>
18-
<tr class="row-even">
18+
<tr>
1919
<td>Rendered as</td>
2020
<td>single text box or three select fields</td>
2121
</tr>
22-
<tr class="row-odd">
22+
<tr>
2323
<td>Options</td>
2424
<td>
2525
<ul>
@@ -30,7 +30,7 @@ <h1>DateTimeType Field<a class="headerlink" href="#datetimetype-field" title="Pe
3030
</ul>
3131
</td>
3232
</tr>
33-
<tr class="row-even">
33+
<tr>
3434
<td>Overridden options</td>
3535
<td>
3636
<ul>
@@ -39,15 +39,15 @@ <h1>DateTimeType Field<a class="headerlink" href="#datetimetype-field" title="Pe
3939
</ul>
4040
</td>
4141
</tr>
42-
<tr class="row-odd">
42+
<tr>
4343
<td>Parent type</td>
4444
<td><a href="form/form_type.html" class="reference internal">FormType</a></td>
4545
</tr>
46-
<tr class="row-even">
46+
<tr>
4747
<td>Class</td>
4848
<td><a href="https://api.symfony.com/4.0/Symfony/Component/Form/Extension/Core/Type/DateTimeType.html" class="reference external" title="Symfony\Component\Form\Extension\Core\Type\DateTimeType">DateTimeType</a></td>
4949
</tr>
50-
<tr class="row-odd">
50+
<tr>
5151
<td>Ref</td>
5252
<td><a href="index.html#reference-forms-type-date-format" class="reference internal">Some Test Docs!</a>
5353
<a href="form/form_type.html#internal-reference" class="reference internal">Test reference</a></td>
@@ -323,21 +323,21 @@ <h3>error_bubbling<a class="headerlink" href="#error-bubbling" title="Permalink
323323

324324
<div class="section" id="field-variables">
325325
<h2>Field Variables<a class="headerlink" href="#field-variables" title="Permalink to this headline"></a></h2>
326-
<table class="docutils" border="1">
327-
<thead valign="bottom">
328-
<tr class="row-odd">
329-
<th class="head">Variable</th>
330-
<th class="head">Type</th>
331-
<th class="head">Usage</th>
326+
<table>
327+
<thead>
328+
<tr>
329+
<th>Variable</th>
330+
<th>Type</th>
331+
<th>Usage</th>
332332
</tr>
333333
</thead>
334-
<tbody valign="top">
335-
<tr class="row-even">
334+
<tbody>
335+
<tr>
336336
<td>widget</td>
337337
<td><code>mixed</code></td>
338338
<td>The value of the <code>widget</code> option</td>
339339
</tr>
340-
<tr class="row-odd">
340+
<tr>
341341
<td>type</td>
342342
<td><code>string</code></td>
343343
<td>Multiple lines of text here, to show

tests/fixtures/expected/toctree/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ <h1>Toctree<a class="headerlink" href="#toctree" title="Permalink to this headli
2828
<div class="toctree-wrapper compound">
2929
<ul>
3030
<li><a href="index.html#toctree">Toctree</a></li>
31-
<li><a href="directory/another_file.html#another-file">Another file</a></li>
3231
<li><a href="file.html#title">Title</a>
3332
<ul>
3433
<li><a href="file.html#sub-title">Sub title</a></li>
3534
</ul>
3635
</li>
36+
<li><a href="directory/another_file.html#another-file">Another file</a></li>
3737
</ul>
3838
</div>
3939
<div class="toctree-wrapper compound">

0 commit comments

Comments
 (0)