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

tests/unit/Model/GroupTest.php (1 issue)

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\Model;
3
4
use Redaxscript\Db;
5
use Redaxscript\Model;
6
use Redaxscript\Tests\TestCaseAbstract;
7
8
/**
9
 * GroupTest
10
 *
11
 * @since 4.0.0
12
 *
13
 * @package Redaxscript
14
 * @category Tests
15
 * @author Henry Ruhs
16
 *
17
 * @covers Redaxscript\Model\Group
18
 */
19
20
class GroupTest 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('groups')
35
			->create()
36
			->set(
37
			[
38
				'name' => 'Group One',
39
				'alias' => 'group-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 $groupAlias
61
	 * @param int $expect
62
	 *
63
	 * @dataProvider providerAutoloader
64
	 */
65
66
	public function testGetByAlias(string $groupAlias = null, int $expect = null) : void
67
	{
68
		/* setup */
69
70
		$groupModel = new Model\Group();
71
72
		/* actual */
73
74
		$actual = $groupModel->getByAlias($groupAlias)?->id;
0 ignored issues
show
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