Page MenuHomeDevCentral

D2537.diff
No OneTemporary

D2537.diff

diff --git a/tests/Output/HTMLOutputTest.php b/tests/Output/HTMLOutputTest.php
--- a/tests/Output/HTMLOutputTest.php
+++ b/tests/Output/HTMLOutputTest.php
@@ -12,26 +12,19 @@
use WithSampleReport;
- ///
- /// Initialization
- //
-
- public Report $report;
-
- protected function setUp () : void {
- $this->report = $this->buildSampleReport();
- }
-
///
/// Tests
//
- public function testRender () : void {
- $actual = HTMLOutput::for($this->report)
- ->render();
+ /**
+ * @dataProvider provideSampleReports
+ */
+ public function testRender (string $name, Report $report) : void {
+ $actual = HTMLOutput::for($report)->render();
- $expected = file_get_contents($this->getDataDir() . "/report.html");
+ $expected = file_get_contents($this->getDataDir() . "/$name.html");
$this->assertEquals($expected, $actual);
}
+
}
diff --git a/tests/Output/MarkdownOutputTest.php b/tests/Output/MarkdownOutputTest.php
--- a/tests/Output/MarkdownOutputTest.php
+++ b/tests/Output/MarkdownOutputTest.php
@@ -12,25 +12,17 @@
use WithSampleReport;
- ///
- /// Initialization
- //
-
- public Report $report;
-
- protected function setUp () : void {
- $this->report = $this->buildSampleReport();
- }
-
///
/// Tests
//
- public function testRender () : void {
- $actual = MarkdownOutput::for($this->report)
- ->render();
+ /**
+ * @dataProvider provideSampleReports
+ */
+ public function testRender (string $name, Report $report) : void {
+ $actual = MarkdownOutput::for($report)->render();
- $expected = file_get_contents($this->getDataDir() . "/report.md");
+ $expected = file_get_contents($this->getDataDir() . "/$name.md");
$this->assertEquals($expected, $actual);
}
diff --git a/tests/Output/XMLOutputTest.php b/tests/Output/XMLOutputTest.php
--- a/tests/Output/XMLOutputTest.php
+++ b/tests/Output/XMLOutputTest.php
@@ -13,25 +13,17 @@
use WithSampleReport;
- ///
- /// Initialization
- //
-
- public Report $report;
-
- protected function setUp () : void {
- $this->report = $this->buildSampleReport();
- }
-
///
/// Tests
//
- public function testRender () : void {
- $actual = XMLOutput::for($this->report)
- ->render();
+ /**
+ * @dataProvider provideSampleReports
+ */
+ public function testRender (string $name, Report $report) : void {
+ $actual = XMLOutput::for($report)->render();
- $expected = file_get_contents($this->getDataDir() . "/report.xml");
+ $expected = file_get_contents($this->getDataDir() . "/$name.xml");
$this->assertEquals($expected, $actual);
}
diff --git a/tests/WithSampleReport.php b/tests/WithSampleReport.php
--- a/tests/WithSampleReport.php
+++ b/tests/WithSampleReport.php
@@ -12,6 +12,19 @@
return __DIR__ . "/data";
}
+ public function provideSampleReports () : iterable {
+ yield ["report", $this->buildSampleReport()];
+ yield ["empty", new Report("Void report")];
+
+ $report = $this->buildSampleReport();
+ $report->properties = [];
+ yield ["no_metadata", $report];
+
+ $report = $this->buildSampleReport();
+ $report->sections = [];
+ yield ["only_metadata", $report];
+ }
+
public function buildSampleReport () : Report {
$report = new Report("Sneakers");
diff --git a/tests/data/empty.html b/tests/data/empty.html
new file mode 100644
--- /dev/null
+++ b/tests/data/empty.html
@@ -0,0 +1 @@
+<h1 id="void-report">Void report</h1>
diff --git a/tests/data/empty.md b/tests/data/empty.md
new file mode 100644
--- /dev/null
+++ b/tests/data/empty.md
@@ -0,0 +1 @@
+# Void report
diff --git a/tests/data/empty.xml b/tests/data/empty.xml
new file mode 100644
--- /dev/null
+++ b/tests/data/empty.xml
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<report title="Void report"/>
diff --git a/tests/data/no_metadata.html b/tests/data/no_metadata.html
new file mode 100644
--- /dev/null
+++ b/tests/data/no_metadata.html
@@ -0,0 +1,15 @@
+<h1 id="sneakers">Sneakers</h1>
+<h2 id="air-max">Air Max</h2>
+<h3 id="air-max-90">Air Max 90</h3>
+<p>One of the more icon color is the infrared.</p>
+<h3 id="air-max-95">Air Max 95</h3>
+<p>Launched in 1995, designed by Sergio Lozano.</p>
+<h3 id="air-max-97">Air Max 97</h3>
+<p>Well highlighted Air bubble.</p>
+<p>Inspired by mountain bikes, while an urban legend quotes Japan bullet trains as inspiration.</p>
+<h2 id="other-nike-air">Other Nike Air</h2>
+<h3 id="introduction">Introduction</h3>
+<p>Because there are other sneakers than Air Max.</p>
+<h3 id="air-force-1">Air Force 1</h3>
+<p>« Air Force 1. Zéro fan, que des fanatiques. » -- LTA</p>
+<h2 id="%F0%9F%91%9F">👟</h2>
diff --git a/tests/data/no_metadata.md b/tests/data/no_metadata.md
new file mode 100644
--- /dev/null
+++ b/tests/data/no_metadata.md
@@ -0,0 +1,29 @@
+# Sneakers
+
+## Air Max
+
+### Air Max 90
+
+One of the more icon color is the infrared.
+
+### Air Max 95
+
+Launched in 1995, designed by Sergio Lozano.
+
+### Air Max 97
+
+Well highlighted Air bubble.
+
+Inspired by mountain bikes, while an urban legend quotes Japan bullet trains as inspiration.
+
+## Other Nike Air
+
+### Introduction
+
+Because there are other sneakers than Air Max.
+
+### Air Force 1
+
+« Air Force 1. Zéro fan, que des fanatiques. » -- LTA
+
+## 👟
diff --git a/tests/data/no_metadata.xml b/tests/data/no_metadata.xml
new file mode 100644
--- /dev/null
+++ b/tests/data/no_metadata.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<report title="Sneakers">
+ <section title="Air Max">
+ <entry title="Air Max 90">
+ <text>One of the more icon color is the infrared.</text>
+ </entry>
+ <entry title="Air Max 95">
+ <text>Launched in 1995, designed by Sergio Lozano.</text>
+ </entry>
+ <entry title="Air Max 97">
+ <text>Well highlighted Air bubble.
+
+Inspired by mountain bikes, while an urban legend quotes Japan bullet trains as inspiration.</text>
+ </entry>
+ </section>
+ <section title="Other Nike Air">
+ <entry title="Introduction">
+ <text>Because there are other sneakers than Air Max.</text>
+ </entry>
+ <entry title="Air Force 1">
+ <text>« Air Force 1. Zéro fan, que des fanatiques. » -- LTA</text>
+ </entry>
+ </section>
+ <section title="👟"/>
+</report>
diff --git a/tests/data/only_metadata.html b/tests/data/only_metadata.html
new file mode 100644
--- /dev/null
+++ b/tests/data/only_metadata.html
@@ -0,0 +1,14 @@
+<h1 id="sneakers">Sneakers</h1>
+<h2 id="report-properties">Report properties</h2>
+<table>
+ <tbody>
+ <tr>
+ <th>Date</th>
+ <td>9999-99-99</td>
+ </tr>
+ <tr>
+ <th>Topic</th>
+ <td>Urban culture</td>
+ </tr>
+ </tbody>
+</table>
diff --git a/tests/data/only_metadata.md b/tests/data/only_metadata.md
new file mode 100644
--- /dev/null
+++ b/tests/data/only_metadata.md
@@ -0,0 +1,6 @@
+# Sneakers
+
+| Property | |
+|----------|---------------|
+| Date | 9999-99-99 |
+| Topic | Urban culture |
diff --git a/tests/data/only_metadata.xml b/tests/data/only_metadata.xml
new file mode 100644
--- /dev/null
+++ b/tests/data/only_metadata.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<report title="Sneakers">
+ <data title="Properties">
+ <entry>
+ <key>Date</key>
+ <value>9999-99-99</value>
+ </entry>
+ <entry>
+ <key>Topic</key>
+ <value>Urban culture</value>
+ </entry>
+ </data>
+</report>

File Metadata

Mime Type
text/plain
Expires
Wed, Dec 25, 01:30 (8 h, 17 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2314360
Default Alt Text
D2537.diff (7 KB)

Event Timeline