Skip to content

Commit b47efc3

Browse files
committed
Optimize test
1 parent 97cbca9 commit b47efc3

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

tests/modules/core/src/Controller/ExceptionTest.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,20 @@
2626
class ExceptionTest extends TestCase
2727
{
2828
/** @var \SimpleSAML\Configuration */
29-
protected Configuration $config;
29+
protected static Configuration $config;
3030

3131
/** @var \SimpleSAML\Session */
32-
protected Session $session;
32+
protected static Session $session;
3333

3434

3535
/**
36-
* Set up for each test.
36+
* Set up before running the test-suite.
3737
*/
38-
protected function setUp(): void
38+
public static function setUpBeforeClass(): void
3939
{
40-
parent::setUp();
40+
parent::setUpBeforeClass();
4141

42-
$this->config = Configuration::loadFromArray(
42+
self::$config = Configuration::loadFromArray(
4343
[
4444
'logging.handler' => ArrayLogger::class,
4545
'errorreporting' => false,
@@ -49,9 +49,9 @@ protected function setUp(): void
4949
'simplesaml'
5050
);
5151

52-
Configuration::setPreLoadedConfig($this->config, 'config.php');
52+
Configuration::setPreLoadedConfig(self::$config, 'config.php');
5353

54-
$this->session = Session::getSessionFromRequest();
54+
self::$session = Session::getSessionFromRequest();
5555
}
5656

5757

@@ -76,7 +76,7 @@ public function testErrorURL(string $code, string $ts, string $rp, string $tid,
7676
'GET',
7777
);
7878

79-
$c = new Controller\Exception($this->config, $this->session);
79+
$c = new Controller\Exception(self::$config, self::$session);
8080

8181
Logger::setCaptureLog();
8282
$response = $c->error($request, $code);
@@ -147,7 +147,7 @@ public function testErrorURLInvalidCode(): void
147147
'/error/doesNotExist',
148148
);
149149

150-
$c = new Controller\Exception($this->config, $this->session);
150+
$c = new Controller\Exception(self::$config, self::$session);
151151

152152
$this->expectException(AssertionFailedException::class);
153153
$this->expectExceptionMessage(

0 commit comments

Comments
 (0)