Completed
Push — master ( 1da492...320203 )
by Henry
07:00
created

tests/unit/Controller/LogoutTest.php (3 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\Controller;
3
4
use Redaxscript\Auth;
5
use Redaxscript\Controller;
6
use Redaxscript\Tests\TestCaseAbstract;
7
8
/**
9
 * LogoutTest
10
 *
11
 * @since 3.0.0
12
 *
13
 * @package Redaxscript
14
 * @category Tests
15
 * @author Henry Ruhs
16
 * @author Balázs Szilágyi
17
 *
18
 * @covers Redaxscript\Controller\ControllerAbstract
19
 * @covers Redaxscript\Controller\Logout
20
 */
21
22
class LogoutTest extends TestCaseAbstract
23
{
24
	/**
25
	 * setUp
26
	 *
27
	 * @since 3.1.0
28
	 */
29
30
	public function setUp() : void
31
	{
32
		parent::setUp();
33
		$optionArray = $this->getOptionArray();
0 ignored issues
show
The method getOptionArray() does not seem to exist on object<Redaxscript\Tests\Controller\LogoutTest>.

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...
34
		$installer = $this->installerFactory();
0 ignored issues
show
The method installerFactory() does not seem to exist on object<Redaxscript\Tests\Controller\LogoutTest>.

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...
35
		$installer->init();
36
		$installer->rawCreate();
37
		$installer->insertUsers($optionArray);
38
	}
39
40
	/**
41
	 * tearDown
42
	 *
43
	 * @since 3.1.0
44
	 */
45
46
	public function tearDown() : void
47
	{
48
		$this->dropDatabase();
0 ignored issues
show
The method dropDatabase() does not seem to exist on object<Redaxscript\Tests\Controller\LogoutTest>.

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...
49
	}
50
51
	/**
52
	 * testProcess
53
	 *
54
	 * @since 3.0.0
55
	 *
56
	 * @param array $authArray
57
	 * @param string $expect
58
	 *
59
	 * @dataProvider providerAutoloader
60
	 */
61
62
	public function testProcess(array $authArray = [], string $expect = null) : void
63
	{
64
		/* setup */
65
66
		$auth = new Auth($this->_request);
67
		$logoutController = new Controller\Logout($this->_registry, $this->_request, $this->_language, $this->_config);
68
		if ($authArray['login'])
69
		{
70
			$auth->login(1);
71
		}
72
		if ($authArray['logout'])
73
		{
74
			$auth->logout();
75
		}
76
77
		/* actual */
78
79
		$actual = $logoutController->process();
80
81
		/* compare */
82
83
		$this->assertEquals($expect, $actual);
84
	}
85
}
86