Completed
Pull Request — master (#16)
by Simon
05:23
created

SiteConfigHelper   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 1
c 0
b 0
f 0
lcom 0
cbo 1
dl 0
loc 12
rs 10
1
<?php
2
3
namespace Firesphere\PartialUserforms\Tests;
4
5
use SilverStripe\SiteConfig\SiteConfig;
6
7
/**
8
 * Class SetupSiteConfig is a simple helper for the setting up of tests.
9
 * To avoid having to re-type the siteconfig creation/setup every time
10
 * @package Firesphere\PartialUserforms\Tests
11
 */
12
class SiteConfigHelper
13
{
14
    public static function setupSiteConfig($addresses = null, $from = null, $send = true, $cleanup = true)
15
    {
16
        $config = SiteConfig::current_site_config();
17
        $config->SendMailTo = $addresses;
18
        $config->SendDailyEmail = $send;
19
        $config->CleanupAfterSend = $cleanup;
20
        $config->SendMailFrom = $from;
21
        $config->write();
22
    }
23
}
24