logseq2gemtext/tests/GemlogParserTest.php

29 lines
699 B
PHP

<?php
declare(strict_types=1);
namespace LogseqGem\Tests;
use PHPUnit\Framework\TestCase;
use org\bovigo\vfs\vfsStream;
use org\bovigo\vfs\vfsStreamDirectory;
use LogseqGem\GemlogParser;
class GemlogParserTest extends TestCase {
private vfsStreamDirectory $root;
public function setUp(): void {
$this->root = vfsStream::setup();
}
public function testLoad() {
vfsStream::newFile('Gemlog.md')
->withContent("- [[Test link]]\n- [[Link 2]]\n-")
->at($this->root);
$parser = new GemlogParser;
$parser->load(vfsStream::url('root/Gemlog.md'));
$this->assertSame(['Test link', 'Link 2'], $parser->getTitles());
}
}