Completed
Pull Request — master (#27)
by Will
09:02
created

TestCookieStore::canWrite()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 4
nc 2
nop 0
1
<?php
2
3
namespace SilverStripe\HybridSessions\Tests\Store;
4
5
use SilverStripe\HybridSessions\Store\CookieStore;
6
use SilverStripe\Dev\TestOnly;
7
8
class TestCookieStore extends CookieStore implements TestOnly
9
{
10
11
12
    /**
13
     * Override value of 'headers_sent' but only if running tests.
14
     *
15
     * Set to true or false, or null to not override
16
     *
17
     * @var string
18
     */
19
    public static $override_headers_sent = null;
20
21
    protected function canWrite()
22
    {
23
        if (self::$override_headers_sent !== null) {
24
            return !self::$override_headers_sent;
25
        }
26
27
        parent::canWrite();
28
    }
29
}
30