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\Controller; |
||
5 | use Redaxscript\Tests\TestCaseAbstract; |
||
6 | |||
7 | /** |
||
8 | * RegisterTest |
||
9 | * |
||
10 | * @since 3.0.0 |
||
11 | * |
||
12 | * @package Redaxscript |
||
13 | * @category Tests |
||
14 | * @author Henry Ruhs |
||
15 | * @author Balázs Szilágyi |
||
16 | * |
||
17 | * @covers Redaxscript\Controller\ControllerAbstract |
||
18 | * @covers Redaxscript\Controller\Register |
||
19 | */ |
||
20 | |||
21 | class RegisterTest extends TestCaseAbstract |
||
22 | { |
||
23 | /** |
||
24 | * setUp |
||
25 | * |
||
26 | * @since 3.1.0 |
||
27 | */ |
||
28 | |||
29 | public function setUp() : void |
||
30 | { |
||
31 | parent::setUp(); |
||
32 | $optionArray = $this->getOptionArray(); |
||
0 ignored issues
–
show
|
|||
33 | $installer = $this->installerFactory(); |
||
0 ignored issues
–
show
The method
installerFactory() does not seem to exist on object<Redaxscript\Tests\Controller\RegisterTest> .
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->init(); |
||
35 | $installer->rawCreate(); |
||
36 | $installer->insertSettings($optionArray); |
||
37 | $installer->insertUsers($optionArray); |
||
38 | $setting = $this->settingFactory(); |
||
0 ignored issues
–
show
The method
settingFactory() does not seem to exist on object<Redaxscript\Tests\Controller\RegisterTest> .
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...
|
|||
39 | $setting->set('captcha', 1); |
||
40 | $setting->set('notification', 1); |
||
41 | } |
||
42 | |||
43 | /** |
||
44 | * tearDown |
||
45 | * |
||
46 | * @since 3.1.0 |
||
47 | */ |
||
48 | |||
49 | public function tearDown() : void |
||
50 | { |
||
51 | $this->dropDatabase(); |
||
0 ignored issues
–
show
The method
dropDatabase() does not seem to exist on object<Redaxscript\Tests\Controller\RegisterTest> .
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...
|
|||
52 | } |
||
53 | |||
54 | /** |
||
55 | * testProcess |
||
56 | * |
||
57 | * @since 3.0.0 |
||
58 | * |
||
59 | * @param array $postArray |
||
60 | * @param string $method |
||
61 | * @param string $expect |
||
62 | * |
||
63 | * @dataProvider providerAutoloader |
||
64 | */ |
||
65 | |||
66 | public function testProcess(array $postArray = [], string $method = null, string $expect = null) : void |
||
67 | { |
||
68 | /* setup */ |
||
69 | |||
70 | $this->_request->set('post', $postArray); |
||
71 | if ($method) |
||
72 | { |
||
73 | $registerController = $this |
||
74 | ->getMockBuilder('Redaxscript\Controller\Register') |
||
75 | ->setConstructorArgs( |
||
76 | [ |
||
77 | $this->_registry, |
||
78 | $this->_request, |
||
79 | $this->_language, |
||
80 | $this->_config |
||
81 | ]) |
||
82 | ->setMethods( |
||
83 | [ |
||
84 | $method |
||
85 | ]) |
||
86 | ->getMock(); |
||
87 | |||
88 | /* override */ |
||
89 | |||
90 | $registerController |
||
91 | ->expects($this->any()) |
||
92 | ->method($method); |
||
93 | } |
||
94 | else |
||
95 | { |
||
96 | $registerController = new Controller\Register($this->_registry, $this->_request, $this->_language, $this->_config); |
||
97 | } |
||
98 | |||
99 | /* actual */ |
||
100 | |||
101 | $actual = $registerController->process(); |
||
0 ignored issues
–
show
The method
process does only exist in Redaxscript\Controller\Register , but not in PHPUnit\Framework\MockObject\MockObject .
It seems like the method you are trying to call exists only in some of the possible types. Let’s take a look at an example: class A
{
public function foo() { }
}
class B extends A
{
public function bar() { }
}
/**
* @param A|B $x
*/
function someFunction($x)
{
$x->foo(); // This call is fine as the method exists in A and B.
$x->bar(); // This method only exists in B and might cause an error.
}
Available Fixes
Loading history...
|
|||
102 | |||
103 | /* compare */ |
||
104 | |||
105 | $this->assertEquals($expect, $actual); |
||
106 | } |
||
107 | } |
||
108 |
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.