85 lines
2.8 KiB
PHP
85 lines
2.8 KiB
PHP
<?php declare(strict_types=1);
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
use tildeteam\wiki;
|
|
|
|
final class WikiTest extends TestCase
|
|
{
|
|
public function testHeaderIds(): void
|
|
{
|
|
$parser = wiki::factory();
|
|
$header = '# hello there';
|
|
$this->assertEquals(
|
|
'<ul class="table-of-contents">
|
|
<li>
|
|
<a href="#hello-there">hello there</a>
|
|
</li>
|
|
</ul>
|
|
<h1><a id="hello-there" href="#hello-there" class="text-warning" aria-hidden="true" title="Permalink">#</a>hello there</h1>
|
|
',
|
|
$parser->parse($header)->getContent()
|
|
);
|
|
}
|
|
|
|
public function testTableClasses(): void
|
|
{
|
|
$parser = wiki::factory();
|
|
$table = '| tilde name | description | where to join | notes |
|
|
| --- | --- | --- | ---|
|
|
| [breadpunk.club](https://breadpunk.club) | breadpunk.club is a small tilde focused on bread-making and community-building. see the [manifesto](https://breadpunk.club/docs/manifesto/) for more information on our mission. | [signup information here](https://breadpunk.club/join/) | |';
|
|
$this->assertEquals(
|
|
'<table>
|
|
<thead>
|
|
<tr>
|
|
<th>tilde name</th>
|
|
<th>description</th>
|
|
<th>where to join</th>
|
|
<th>notes</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td><a href="https://breadpunk.club">breadpunk.club</a></td>
|
|
<td>breadpunk.club is a small tilde focused on bread-making and community-building. see the <a href="https://breadpunk.club/docs/manifesto/">manifesto</a> for more information on our mission.</td>
|
|
<td><a href="https://breadpunk.club/join/">signup information here</a></td>
|
|
<td></td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
',
|
|
$parser->parse($table)->getContent()
|
|
);
|
|
}
|
|
|
|
public function testTableClassesWithBootstrap(): void
|
|
{
|
|
$parser = wiki::factory(true);
|
|
$table = '| tilde name | description | where to join | notes |
|
|
| --- | --- | --- | ---|
|
|
| [breadpunk.club](https://breadpunk.club) | breadpunk.club is a small tilde focused on bread-making and community-building. see the [manifesto](https://breadpunk.club/docs/manifesto/) for more information on our mission. | [signup information here](https://breadpunk.club/join/) | |';
|
|
$this->assertEquals(
|
|
'<table class="table table-responsive table-hover table-striped">
|
|
<thead>
|
|
<tr>
|
|
<th>tilde name</th>
|
|
<th>description</th>
|
|
<th>where to join</th>
|
|
<th>notes</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td><a href="https://breadpunk.club">breadpunk.club</a></td>
|
|
<td>breadpunk.club is a small tilde focused on bread-making and community-building. see the <a href="https://breadpunk.club/docs/manifesto/">manifesto</a> for more information on our mission.</td>
|
|
<td><a href="https://breadpunk.club/join/">signup information here</a></td>
|
|
<td></td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
'
|
|
,
|
|
$parser->parse($table)->getContent()
|
|
);
|
|
}
|
|
}
|