Completed
Push — master ( 16ddfb...0ea243 )
by Henry
09:18
created

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

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 =
32
		[
33
			'adminName' => 'Test',
34
			'adminUser' => 'test',
35
			'adminPassword' => 'test',
36
			'adminEmail' => '[email protected]'
37
		];
38
		$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...
39
		$installer->init();
40
		$installer->rawCreate();
41
		$installer->insertSettings($optionArray);
42
		$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...
43
		$setting->set('captcha', 1);
44
	}
45
46
	/**
47
	 * tearDown
48
	 *
49
	 * @since 3.1.0
50
	 */
51
52
	public function tearDown() : void
53
	{
54
		$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...
55
	}
56
57
	/**
58
	 * testRender
59
	 *
60
	 * @since 3.0.0
61
	 *
62
	 * @param int $articleId
63
	 * @param array $expectArray
64
	 *
65
	 * @dataProvider providerAutoloader
66
	 */
67
68
	public function testRender(int $articleId = null, array $expectArray = []) : void
69
	{
70
		/* setup */
71
72
		$commentForm = new View\CommentForm($this->_registry, $this->_language);
73
74
		/* actual */
75
76
		$actual = $commentForm->render($articleId);
77
78
		/* compare */
79
80
		$this->assertStringStartsWith($expectArray['start'], $actual);
81
		$this->assertStringEndsWith($expectArray['end'], $actual);
82
	}
83
}
84