1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* @license LGPLv3, http://opensource.org/licenses/LGPL-3.0 |
5
|
|
|
* @copyright Aimeos (aimeos.org), 2021 |
6
|
|
|
*/ |
7
|
|
|
|
8
|
|
|
|
9
|
|
|
namespace Aimeos\Client\Html\Cms\Page\Contact; |
10
|
|
|
|
11
|
|
|
|
12
|
|
|
class StandardTest extends \PHPUnit\Framework\TestCase |
|
|
|
|
13
|
|
|
{ |
14
|
|
|
private $object; |
15
|
|
|
private $context; |
16
|
|
|
|
17
|
|
|
|
18
|
|
|
protected function setUp() : void |
19
|
|
|
{ |
20
|
|
|
$this->context = \TestHelperHtml::getContext(); |
21
|
|
|
|
22
|
|
|
$this->object = new \Aimeos\Client\Html\Cms\Page\Contact\Standard( $this->context ); |
23
|
|
|
$this->object->setView( \TestHelperHtml::getView() ); |
24
|
|
|
} |
25
|
|
|
|
26
|
|
|
|
27
|
|
|
protected function tearDown() : void |
28
|
|
|
{ |
29
|
|
|
unset( $this->object ); |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
|
33
|
|
|
public function testGetBody() |
34
|
|
|
{ |
35
|
|
|
$this->object->setView( $this->object->addData( $this->object->getView() ) ); |
36
|
|
|
$output = $this->object->getBody(); |
37
|
|
|
$this->assertEquals( '', $output ); |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
|
41
|
|
|
public function testGetSubClient() |
42
|
|
|
{ |
43
|
|
|
$this->expectException( '\\Aimeos\\Client\\Html\\Exception' ); |
44
|
|
|
$this->object->getSubClient( 'invalid', 'invalid' ); |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
|
48
|
|
|
public function testProcess() |
49
|
|
|
{ |
50
|
|
|
$this->context->getConfig()->set( 'resource/email/from-address', 'rcpt@localhost' ); |
51
|
|
|
|
52
|
|
|
$view = $this->object->getView(); |
53
|
|
|
$param = [ |
54
|
|
|
'contact' => [ |
55
|
|
|
'name' => 'test', |
56
|
|
|
'email' => 'test@localhost', |
57
|
|
|
'message' => 'Test msg', |
58
|
|
|
'url' => '' |
59
|
|
|
] |
60
|
|
|
]; |
61
|
|
|
|
62
|
|
|
$helper = new \Aimeos\MW\View\Helper\Param\Standard( $view, $param ); |
63
|
|
|
$view->addHelper( 'param', $helper ); |
64
|
|
|
|
65
|
|
|
$this->object->process(); |
66
|
|
|
|
67
|
|
|
$this->assertEquals( 1, count( $view->pageErrorList ) ); |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
|
71
|
|
|
public function testProcessHoneypot() |
72
|
|
|
{ |
73
|
|
|
$this->context->getConfig()->set( 'resource/email/from-address', 'rcpt@localhost' ); |
74
|
|
|
|
75
|
|
|
$view = $this->object->getView(); |
76
|
|
|
$param = [ |
77
|
|
|
'contact' => [ |
78
|
|
|
'name' => 'test', |
79
|
|
|
'email' => 'test@localhost', |
80
|
|
|
'message' => 'Test msg', |
81
|
|
|
'url' => 'http://localhost' |
82
|
|
|
] |
83
|
|
|
]; |
84
|
|
|
|
85
|
|
|
$helper = new \Aimeos\MW\View\Helper\Param\Standard( $view, $param ); |
86
|
|
|
$view->addHelper( 'param', $helper ); |
87
|
|
|
|
88
|
|
|
$this->object->process(); |
89
|
|
|
|
90
|
|
|
$this->assertEquals( 0, count( $view->get( 'pageErrorList', [] ) ) ); |
91
|
|
|
} |
92
|
|
|
|
93
|
|
|
|
94
|
|
|
public function testProcessError() |
95
|
|
|
{ |
96
|
|
|
$view = $this->object->getView(); |
97
|
|
|
$param = [ |
98
|
|
|
'contact' => [ |
99
|
|
|
'name' => 'test', |
100
|
|
|
'email' => 'test@localhost', |
101
|
|
|
'message' => 'Test msg', |
102
|
|
|
'url' => '' |
103
|
|
|
] |
104
|
|
|
]; |
105
|
|
|
|
106
|
|
|
$helper = new \Aimeos\MW\View\Helper\Param\Standard( $view, $param ); |
107
|
|
|
$view->addHelper( 'param', $helper ); |
108
|
|
|
|
109
|
|
|
$this->object->process(); |
110
|
|
|
|
111
|
|
|
$this->assertEquals( 1, count( $view->pageErrorList ) ); |
112
|
|
|
} |
113
|
|
|
} |
114
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths