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

tests/unit/Admin/View/CommentTableTest.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
 * CommentTableTest
10
 *
11
 * @since 4.0.0
12
 *
13
 * @package Redaxscript
14
 * @category Tests
15
 * @author Henry Ruhs
16
 *
17
 * @covers Redaxscript\Admin\View\CommentTable
18
 * @covers Redaxscript\Admin\View\ViewAbstract
19
 */
20
21
class CommentTableTest extends TestCaseAbstract
22
{
23
	/**
24
	 * setUp
25
	 *
26
	 * @since 4.0.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...\View\CommentTableTest>.

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
		$articleOne = Db::forTablePrefix('articles')->create();
36
		$articleOne
37
			->set(
38
			[
39
				'title' => 'Article One',
40
				'alias' => 'article-one'
41
			])
42
			->save();
43
		Db::forTablePrefix('comments')
44
			->create()
45
			->set(
46
			[
47
				'author' => 'Comment One',
48
				'text' => 'Comment One',
49
				'article' => $articleOne->id
50
			])
51
			->save();
52
	}
53
54
	/**
55
	 * tearDown
56
	 *
57
	 * @since 4.0.0
58
	 */
59
60
	public function tearDown() : void
61
	{
62
		$this->dropDatabase();
0 ignored issues
show
The method dropDatabase() does not seem to exist on object<Redaxscript\Tests...\View\CommentTableTest>.

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