Completed
Push — master ( 1da492...320203 )
by Henry
07:00
created

tests/unit/View/CommentFormTest.php (4 issues)

Labels
Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

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();
0 ignored issues
show
The method getOptionArray() does not seem to exist on object<Redaxscript\Tests\View\CommentFormTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
32
		$installer = $this->installerFactory();
0 ignored issues
show
The method installerFactory() does not seem to exist on object<Redaxscript\Tests\View\CommentFormTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
33
		$installer->init();
34
		$installer->rawCreate();
35
		$installer->insertSettings($optionArray);
36
		$setting = $this->settingFactory();
0 ignored issues
show
The method settingFactory() does not seem to exist on object<Redaxscript\Tests\View\CommentFormTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
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();
0 ignored issues
show
The method dropDatabase() does not seem to exist on object<Redaxscript\Tests\View\CommentFormTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
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