Skip to content

Commit e4f0115

Browse files
jmschejmsche
authored andcommitted
Allow test to fail
1 parent 6dd4fc2 commit e4f0115

File tree

1 file changed

+17
-12
lines changed

1 file changed

+17
-12
lines changed

tests/Utility/UConfigurationTest.php

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,31 @@
77
use Leapt\FroalaEditorBundle\Utility\UConfiguration;
88
use PHPUnit\Framework\TestCase;
99
use Symfony\Component\DomCrawler\Crawler;
10+
use Symfony\Component\HttpClient\Exception\ClientException;
1011
use Symfony\Component\HttpClient\HttpClient;
1112

1213
final class UConfigurationTest extends TestCase
1314
{
1415
public function testAllOptionsAreRegistered(): void
1516
{
16-
$url = 'https://froala.com/wysiwyg-editor/docs/options/';
17-
$httpClient = HttpClient::create();
18-
$crawler = new Crawler($httpClient->request('GET', $url)->getContent());
19-
$optionsFromDocs = $crawler->filter('.docs-data-list.block-box a');
20-
$registeredOptions = UConfiguration::getArrOptionAll();
21-
$proxyOrIgnoredOptions = ['Key', 'editor'];
22-
$missingOptions = [];
17+
try {
18+
$url = 'https://froala.com/wysiwyg-editor/docs/options/';
19+
$httpClient = HttpClient::create();
20+
$crawler = new Crawler($httpClient->request('GET', $url)->getContent());
21+
$optionsFromDocs = $crawler->filter('.docs-data-list.block-box a');
22+
$registeredOptions = UConfiguration::getArrOptionAll();
23+
$proxyOrIgnoredOptions = ['Key', 'editor'];
24+
$missingOptions = [];
2325

24-
foreach ($optionsFromDocs as $option) {
25-
if (!\in_array($option->textContent, $registeredOptions, true) && !\in_array($option->textContent, $proxyOrIgnoredOptions, true)) {
26-
$missingOptions[] = $option->textContent;
26+
foreach ($optionsFromDocs as $option) {
27+
if (!\in_array($option->textContent, $registeredOptions, true) && !\in_array($option->textContent, $proxyOrIgnoredOptions, true)) {
28+
$missingOptions[] = $option->textContent;
29+
}
2730
}
28-
}
2931

30-
self::assertSame([], $missingOptions);
32+
self::assertSame([], $missingOptions);
33+
} catch (ClientException $e) {
34+
$this->markTestSkipped(sprintf('Unable to retrieve options docs page: %s', $e->getMessage()));
35+
}
3136
}
3237
}

0 commit comments

Comments
 (0)