CommentFormTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 58
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 1
dl 0
loc 58
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 11 1
A tearDown() 0 4 1
A testRender() 0 15 1
1
<?php
2
namespace Redaxscript\Tests\View;
3
4
use Redaxscript\Tests\TestCaseAbstract;
5
use Redaxscript\View;
6
7
/**
8
 * CommentFormTest
9
 *
10
 * @since 3.0.0
11
 *
12
 * @package Redaxscript
13
 * @category Tests
14
 * @author Henry Ruhs
15
 *
16
 * @covers Redaxscript\View\CommentForm
17
 * @covers Redaxscript\View\ViewAbstract
18
 */
19
20
class CommentFormTest extends TestCaseAbstract
21
{
22
	/**
23
	 * setUp
24
	 *
25
	 * @since 3.1.0
26
	 */
27
28
	public function setUp() : void
29
	{
30
		parent::setUp();
31
		$optionArray = $this->getOptionArray();
32
		$installer = $this->installerFactory();
33
		$installer->init();
34
		$installer->rawCreate();
35
		$installer->insertSettings($optionArray);
36
		$setting = $this->settingFactory();
37
		$setting->set('captcha', 1);
38
	}
39
40
	/**
41
	 * tearDown
42
	 *
43
	 * @since 3.1.0
44
	 */
45
46
	public function tearDown() : void
47
	{
48
		$this->dropDatabase();
49
	}
50
51
	/**
52
	 * testRender
53
	 *
54
	 * @since 3.0.0
55
	 *
56
	 * @param int $articleId
57
	 * @param array $expectArray
58
	 *
59
	 * @dataProvider providerAutoloader
60
	 */
61
62
	public function testRender(int $articleId = null, array $expectArray = []) : void
63
	{
64
		/* setup */
65
66
		$commentForm = new View\CommentForm($this->_registry, $this->_language);
67
68
		/* actual */
69
70
		$actual = $commentForm->render($articleId);
71
72
		/* compare */
73
74
		$this->assertStringStartsWith($expectArray['start'], $actual);
75
		$this->assertStringEndsWith($expectArray['end'], $actual);
76
	}
77
}
78