Files
dokuwiki-plugin-prosemirror/_test/nodestack.test.php
Michael Große 93e65885ad style: whitespace changes by idea
These kept leaking into other commits, so here is one big change in hope
of reducing future noise.
2018-02-08 17:32:01 +01:00

46 lines
967 B
PHP

<?php
use dokuwiki\plugin\prosemirror\schema\Node;
use dokuwiki\plugin\prosemirror\schema\NodeStack;
/**
* NodeStack tests for the prosemirror plugin
*
* @group plugin_prosemirror
* @group plugins
*/
class nodestack_plugin_prosemirror_test extends DokuWikiTest
{
public function test_init()
{
$nodestack = new NodeStack();
$this->assertSame('doc', $nodestack->current()->getType());
}
public function test_addpop()
{
$nodestack = new NodeStack();
$node = new Node('foo');
$nodestack->addTop($node);
$this->assertSame($node, $nodestack->current());
$popped = $nodestack->drop('foo');
$this->assertSame($node, $popped);
}
public function test_dropfail()
{
$this->expectException('\\RuntimeException');
$nodestack = new NodeStack();
$node = new Node('foo');
$nodestack->addTop($node);
$nodestack->drop('baz');
}
}