Completed
Push — master ( f1e0df...7f9031 )
by Henry
07:35
created

ExtraTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 61
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 2
dl 0
loc 61
rs 10
c 0
b 0
f 0
1
<?php
2
namespace Redaxscript\Tests\Model;
3
4
use Redaxscript\Db;
5
use Redaxscript\Model;
6
use Redaxscript\Tests\TestCaseAbstract;
7
8
/**
9
 * ExtraTest
10
 *
11
 * @since 4.0.0
12
 *
13
 * @package Redaxscript
14
 * @category Tests
15
 * @author Henry Ruhs
16
 *
17
 * @covers Redaxscript\Model\Extra
18
 */
19
20
class ExtraTest extends TestCaseAbstract
21
{
22
	/**
23
	 * setUp
24
	 *
25
	 * @since 4.0.0
26
	 */
27
28
	public function setUp() : void
29
	{
30
		parent::setUp();
31
		$installer = $this->installerFactory();
32
		$installer->init();
33
		$installer->rawCreate();
34
		Db::forTablePrefix('extras')
35
			->create()
36
			->set(
37
			[
38
				'title' => 'Extra One',
39
				'alias' => 'extra-one'
40
			])
41
			->save();
42
	}
43
44
	/**
45
	 * tearDown
46
	 *
47
	 * @since 4.0.0
48
	 */
49
50
	public function tearDown() : void
51
	{
52
		$this->dropDatabase();
53
	}
54
55
	/**
56
	 * testGetByAlias
57
	 *
58
	 * @since 4.0.0
59
	 *
60
	 * @param string $extraAlias
61
	 * @param int $expect
62
	 *
63
	 * @dataProvider providerAutoloader
64
	 */
65
66
	public function testGetByAlias(string $extraAlias = null, int $expect = null) : void
67
	{
68
		/* setup */
69
70
		$extraModel = new Model\Extra();
71
72
		/* actual */
73
74
		$actual = $extraModel->getByAlias($extraAlias)?->id;
0 ignored issues
show
Bug introduced by
This code did not parse for me. Apparently, there is an error somewhere around this line:

Syntax error, unexpected T_OBJECT_OPERATOR
Loading history...
75
76
		/* compare */
77
78
		$this->assertEquals($expect, $actual);
79
	}
80
}
81