Skip to content
This repository was archived by the owner on Feb 21, 2025. It is now read-only.

Commit e9b9c8c

Browse files
author
Simon Erkelens
committed
Minor test fixes
1 parent e4b091f commit e9b9c8c

File tree

1 file changed

+3
-17
lines changed

1 file changed

+3
-17
lines changed

tests/unit/ControllerExtensionTest.php

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -56,34 +56,20 @@ public function testInit()
5656
public function testNonceOnExcludedControllers()
5757
{
5858
//when CSPBackend.useNonce is true, it should only apply to controllers
59-
//with the extension applied. By default, this is page controller
59+
//with the extension applied. By default, this is root controller
6060
CSPBackend::setUsesNonce(true);
6161
$page = new Page();
6262
$controller = new PageController($page);
6363
$extension = new ControllerCSPExtension();
6464

6565
$extension->setOwner($controller);
6666

67-
//useNonce is set but only applies on the PageController.
68-
//let's check Security controller for logins: it should be absent
67+
//let's check Security controller for logins: it should be there
6968
$secController = new Security();
70-
$this->expectException('BadMethodCallException');
71-
$this->assertNull($secController->getNonce());
69+
$this->assertNotNull($secController->getNonce());
7270

7371
//also check CMS-level controllers
7472
$cmsController = new LeftAndMain();
75-
$this->expectException('BadMethodCallException');
76-
$this->assertNull($secController->getNonce());
77-
78-
//now apply the extension, getNonce should not be null
79-
$extension2 = new ControllerCSPExtension();
80-
81-
$extension2->setOwner($secController);
8273
$this->assertNotNull($secController->getNonce());
83-
84-
$extension3 = new ControllerCSPExtension();
85-
86-
$extension3->setOwner($cmsController);
87-
$this->assertNotNull($cmsController->getNonce());
8874
}
8975
}

0 commit comments

Comments
 (0)