ArticleTableTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 62
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 2
dl 0
loc 62
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 15 1
A tearDown() 0 4 1
A testRender() 0 15 1
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
 * ArticleTableTest
10
 *
11
 * @since 4.0.0
12
 *
13
 * @package Redaxscript
14
 * @category Tests
15
 * @author Henry Ruhs
16
 *
17
 * @covers Redaxscript\Admin\View\ArticleTable
18
 * @covers Redaxscript\Admin\View\ViewAbstract
19
 */
20
21
class ArticleTableTest 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();
33
		$installer->init();
34
		$installer->rawCreate();
35
		Db::forTablePrefix('articles')
36
			->create()
37
			->set(
38
			[
39
				'title' => 'Article One',
40
				'alias' => 'article-one'
41
			])
42
			->save();
43
	}
44
45
	/**
46
	 * tearDown
47
	 *
48
	 * @since 4.0.0
49
	 */
50
51
	public function tearDown() : void
52
	{
53
		$this->dropDatabase();
54
	}
55
56
	/**
57
	 * testRender
58
	 *
59
	 * @since 4.0.0
60
	 *
61
	 * @param array $registryArray
62
	 * @param string $expect
63
	 *
64
	 * @dataProvider providerAutoloader
65
	 */
66
67
	public function testRender(array $registryArray = [], string $expect = null) : void
68
	{
69
		/* setup */
70
71
		$this->_registry->init($registryArray);
72
		$articleTable = new Admin\View\ArticleTable($this->_registry, $this->_language);
73
74
		/* actual */
75
76
		$actual = $articleTable->render();
77
78
		/* compare */
79
80
		$this->assertEquals($expect, $actual);
81
	}
82
}
83