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

tests/unit/Admin/View/GroupFormTest.php (2 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\Admin\View;
3
4
use Redaxscript\Admin;
5
use Redaxscript\Db;
6
use Redaxscript\Tests\TestCaseAbstract;
7
8
/**
9
 * GroupFormTest
10
 *
11
 * @since 3.0.0
12
 *
13
 * @package Redaxscript
14
 * @category Tests
15
 * @author Henry Ruhs
16
 *
17
 * @covers Redaxscript\Admin\View\GroupForm
18
 * @covers Redaxscript\Admin\View\ViewAbstract
19
 */
20
21
class GroupFormTest extends TestCaseAbstract
22
{
23
	/**
24
	 * setUp
25
	 *
26
	 * @since 3.1.0
27
	 */
28
29
	public function setUp() : void
30
	{
31
		parent::setUp();
32
		$installer = $this->installerFactory();
0 ignored issues
show
The method installerFactory() does not seem to exist on object<Redaxscript\Tests...min\View\GroupFormTest>.

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
		Db::forTablePrefix('groups')
36
			->create()
37
			->set(
38
			[
39
				'name' => 'Group One',
40
				'alias' => 'group-one',
41
			])
42
			->save();
43
		Db::forTablePrefix('groups')
44
			->create()
45
			->set(
46
			[
47
				'name' => 'Group Two',
48
				'alias' => 'group-two',
49
			])
50
			->save();
51
	}
52
53
	/**
54
	 * tearDown
55
	 *
56
	 * @since 3.1.0
57
	 */
58
59
	public function tearDown() : void
60
	{
61
		$this->dropDatabase();
0 ignored issues
show
The method dropDatabase() does not seem to exist on object<Redaxscript\Tests...min\View\GroupFormTest>.

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...
62
	}
63
64
	/**
65
	 * testRender
66
	 *
67
	 * @since 3.0.0
68
	 *
69
	 * @param array $registryArray
70
	 * @param int $groupId
71
	 * @param array $expectArray
72
	 *
73
	 * @dataProvider providerAutoloader
74
	 */
75
76
	public function testRender(array $registryArray = [], int $groupId = null, array $expectArray = []) : void
77
	{
78
		/* setup */
79
80
		$this->_registry->init($registryArray);
81
		$groupForm = new Admin\View\GroupForm($this->_registry, $this->_language);
82
83
		/* actual */
84
85
		$actual = $groupForm->render($groupId);
86
87
		/* compare */
88
89
		$this->assertStringStartsWith($expectArray['start'], $actual);
90
		$this->assertStringEndsWith($expectArray['end'], $actual);
91
	}
92
}
93