-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathSyntaxTest.php
54 lines (49 loc) · 1.8 KB
/
SyntaxTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
namespace Thunder\Shortcode\Tests;
use Thunder\Shortcode\Syntax\Syntax;
use Thunder\Shortcode\Syntax\CommonSyntax;
use Thunder\Shortcode\Syntax\SyntaxBuilder;
use Thunder\Shortcode\Syntax\SyntaxInterface;
/**
* @author Tomasz Kowalczyk <tomasz@kowalczyk.cc>
*/
final class SyntaxTest extends AbstractTestCase
{
/**
* @dataProvider provideSyntaxes
*/
public function testSyntax(SyntaxInterface $syntax, $open, $close, $slash, $parameter, $value)
{
static::assertSame($open, $syntax->getOpeningTag());
static::assertSame($close, $syntax->getClosingTag());
static::assertSame($slash, $syntax->getClosingTagMarker());
static::assertSame($parameter, $syntax->getParameterValueSeparator());
static::assertSame($value, $syntax->getParameterValueDelimiter());
}
public static function provideSyntaxes()
{
return array(
array(new Syntax(), '[', ']', '/', '=', '"'),
array(new Syntax('[[', ']]', '//', '==', '""'), '[[', ']]', '//', '==', '""'),
array(new CommonSyntax(), '[', ']', '/', '=', '"'),
);
}
/**
* Note: do not merge this test with data provider above, code coverage
* does not understand this and marks builder class as untested.
*/
public function testBuilder()
{
$builder = new SyntaxBuilder();
$this->testSyntax($builder->getSyntax(), '[', ']', '/', '=', '"');
$builder = new SyntaxBuilder();
$doubleBuiltSyntax = $builder
->setOpeningTag('[[')
->setClosingTag(']]')
->setClosingTagMarker('//')
->setParameterValueSeparator('==')
->setParameterValueDelimiter('""')
->getSyntax();
$this->testSyntax($doubleBuiltSyntax, '[[', ']]', '//', '==', '""');
}
}