Completed
Push — master ( 8024d2...3434fe )
by Henry
08:54
created

SearchTest::testCreateColumnArray()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 17

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 17
rs 9.7
c 0
b 0
f 0
cc 1
nc 1
nop 2
1
<?php
2
namespace Redaxscript\Tests\Model;
3
4
use Redaxscript\Model;
5
use Redaxscript\Tests\TestCaseAbstract;
6
7
/**
8
 * SearchTest
9
 *
10
 * @since 4.0.0
11
 *
12
 * @package Redaxscript
13
 * @category Tests
14
 * @author Henry Ruhs
15
 *
16
 * @covers Redaxscript\Model\Search
17
 */
18
19
class SearchTest extends TestCaseAbstract
20
{
21
	/**
22
	 * setUp
23
	 *
24
	 * @since 4.0.0
25
	 */
26
27
	public function setUp() : void
28
	{
29
		parent::setUp();
30
		$installer = $this->installerFactory();
31
		$installer->init();
32
		$installer->rawCreate();
33
	}
34
35
	/**
36
	 * tearDown
37
	 *
38
	 * @since 4.0.0
39
	 */
40
41
	public function tearDown() : void
42
	{
43
		$this->dropDatabase();
44
	}
45
46
	/**
47
	 * testCreateColumnArray
48
	 *
49
	 * @since 4.0.0
50
	 *
51
	 * @param string $table
52
	 * @param array $expectArray
53
	 *
54
	 * @dataProvider providerAutoloader
55
	 */
56
57
	public function testCreateColumnArray(string $table = null, array $expectArray = []) : void
58
	{
59
		/* setup */
60
61
		$searchModel = new Model\Search();
62
63
		/* actual */
64
65
		$actualArray = $this->callMethod($searchModel, '_createColumnArray',
66
		[
67
			$table
68
		]);
69
70
		/* compare */
71
72
		$this->assertEquals($expectArray, $actualArray);
73
	}
74
75
76
	/**
77
	 * testCreateLikeArray
78
	 *
79
	 * @since 4.0.0
80
	 *
81
	 * @param string $table
82
	 * @param string $search
83
	 * @param array $expectArray
84
	 *
85
	 * @dataProvider providerAutoloader
86
	 */
87
88
	public function testCreateLikeArray(string $table = null, string $search = null, array $expectArray = []) : void
89
	{
90
		/* setup */
91
92
		$searchModel = new Model\Search();
93
94
		/* actual */
95
96
		$actualArray = $this->callMethod($searchModel, '_createLikeArray',
97
		[
98
			$table,
99
			$search
100
		]);
101
102
		/* compare */
103
104
		$this->assertEquals($expectArray, $actualArray);
105
	}
106
}
107