Skip to content

Commit a9cd190

Browse files
committed
test: add test
1 parent 0d94606 commit a9cd190

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

tests/system/Honeypot/HoneypotTest.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,24 @@ public function testAttachHoneypotAndContainerWithCSP(): void
100100
$this->assertMatchesRegularExpression($regex, $this->response->getBody());
101101
}
102102

103+
public function testNotAttachHoneypotWithCSP(): void
104+
{
105+
$this->resetServices();
106+
107+
$config = new App();
108+
$config->CSPEnabled = true;
109+
Factories::injectMock('config', 'App', $config);
110+
$this->response = Services::response($config, false);
111+
112+
$this->config = new HoneypotConfig();
113+
$this->honeypot = new Honeypot($this->config);
114+
115+
$this->response->setBody('<head></head><body></body>');
116+
$this->honeypot->attachHoneypot($this->response);
117+
118+
$this->assertSame('<head></head><body></body>', $this->response->getBody());
119+
}
120+
103121
public function testHasntContent(): void
104122
{
105123
unset($_POST[$this->config->name]);

0 commit comments

Comments
 (0)