Passed
Push — master ( 7075a8...97270a )
by Robbie
09:53 queued 07:47
created
src/Extensions/CwpSiteSummaryExtension.php 1 patch
Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -5,41 +5,41 @@
 block discarded – undo
5 5
  */
6 6
 class CwpSiteSummaryExtension extends Extension
7 7
 {
8
-    /**
9
-     * Updates the modules used for the version label by:
10
-     *  - Removing SS Framework
11
-     *  - Adding CWP
12
-     *  - Relabelling SS CMS
13
-     *
14
-     * @param array $modules
15
-     */
16
-    public function updateVersionModules(&$modules)
17
-    {
18
-        unset($modules['silverstripe/framework']);
19
-        $modules = ['cwp/cwp' => 'CWP'] + $modules;
20
-        $modules['silverstripe/cms'] = 'SilverStripe CMS';
21
-    }
8
+	/**
9
+	 * Updates the modules used for the version label by:
10
+	 *  - Removing SS Framework
11
+	 *  - Adding CWP
12
+	 *  - Relabelling SS CMS
13
+	 *
14
+	 * @param array $modules
15
+	 */
16
+	public function updateVersionModules(&$modules)
17
+	{
18
+		unset($modules['silverstripe/framework']);
19
+		$modules = ['cwp/cwp' => 'CWP'] + $modules;
20
+		$modules['silverstripe/cms'] = 'SilverStripe CMS';
21
+	}
22 22
 
23
-    /**
24
-     * Updates the dropdown filter used to filter supported packages by renaming the labels (replaces the existing
25
-     * filter options)
26
-     *
27
-     * @param GridFieldDropdownFilter $dropdownFilter
28
-     */
29
-    public function updateDropdownFilterOptions($dropdownFilter)
30
-    {
31
-        $dropdownFilter->removeFilterOption('supported');
32
-        $dropdownFilter->removeFilterOption('unsupported');
23
+	/**
24
+	 * Updates the dropdown filter used to filter supported packages by renaming the labels (replaces the existing
25
+	 * filter options)
26
+	 *
27
+	 * @param GridFieldDropdownFilter $dropdownFilter
28
+	 */
29
+	public function updateDropdownFilterOptions($dropdownFilter)
30
+	{
31
+		$dropdownFilter->removeFilterOption('supported');
32
+		$dropdownFilter->removeFilterOption('unsupported');
33 33
 
34
-        $dropdownFilter->addFilterOption(
35
-            'supported',
36
-            _t(__CLASS__ . '.FilterSupported', 'CWP recipe modules'),
37
-            ['Supported' => true]
38
-        );
39
-        $dropdownFilter->addFilterOption(
40
-            'unsupported',
41
-            _t(__CLASS__ . '.FilterUnsupported', 'Non CWP modules'),
42
-            ['Supported' => false]
43
-        );
44
-    }
34
+		$dropdownFilter->addFilterOption(
35
+			'supported',
36
+			_t(__CLASS__ . '.FilterSupported', 'CWP recipe modules'),
37
+			['Supported' => true]
38
+		);
39
+		$dropdownFilter->addFilterOption(
40
+			'unsupported',
41
+			_t(__CLASS__ . '.FilterUnsupported', 'Non CWP modules'),
42
+			['Supported' => false]
43
+		);
44
+	}
45 45
 }
Please login to merge, or discard this patch.
src/Extensions/MaintenanceProxyExtension.php 1 patch
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -13,48 +13,48 @@
 block discarded – undo
13 13
  */
14 14
 class MaintenanceProxyExtension extends Extension
15 15
 {
16
-    /**
17
-     * Configures required environment settings for Composer's use, applies to
18
-     * {@link \BringYourOwnIdeas\Maintenance\Util\ComposerLoader} and is applied before ComposerLoaderExtension in
19
-     * bringyourownideas/silverstripe-composer-update-checker to ensure the proxy information is set before Composer
20
-     * is created
21
-     */
22
-    public function onAfterBuild()
23
-    {
24
-        // Provide access for Composer's StreamContextFactory, since it creates its own stream context
25
-        if ($proxy = $this->getCwpProxy()) {
26
-            $_SERVER['CGI_HTTP_PROXY'] = $proxy;
27
-        }
28
-    }
16
+	/**
17
+	 * Configures required environment settings for Composer's use, applies to
18
+	 * {@link \BringYourOwnIdeas\Maintenance\Util\ComposerLoader} and is applied before ComposerLoaderExtension in
19
+	 * bringyourownideas/silverstripe-composer-update-checker to ensure the proxy information is set before Composer
20
+	 * is created
21
+	 */
22
+	public function onAfterBuild()
23
+	{
24
+		// Provide access for Composer's StreamContextFactory, since it creates its own stream context
25
+		if ($proxy = $this->getCwpProxy()) {
26
+			$_SERVER['CGI_HTTP_PROXY'] = $proxy;
27
+		}
28
+	}
29 29
 
30
-    /**
31
-     * Provide proxy options for {@link \BringYourOwnIdeas\Maintenance\Util\ApiLoader} instances to use in
32
-     * their Guzzle clients
33
-     *
34
-     * @param array $options
35
-     */
36
-    public function updateClientOptions(&$options)
37
-    {
38
-        if ($proxy = $this->getCwpProxy()) {
39
-            $options['proxy'] = $proxy;
40
-        }
41
-    }
30
+	/**
31
+	 * Provide proxy options for {@link \BringYourOwnIdeas\Maintenance\Util\ApiLoader} instances to use in
32
+	 * their Guzzle clients
33
+	 *
34
+	 * @param array $options
35
+	 */
36
+	public function updateClientOptions(&$options)
37
+	{
38
+		if ($proxy = $this->getCwpProxy()) {
39
+			$options['proxy'] = $proxy;
40
+		}
41
+	}
42 42
 
43
-    /**
44
-     * Returns a formatted CWP proxy string, e.g. `tcp://proxy.cwp.govt.nz:1234`
45
-     *
46
-     * @return string
47
-     */
48
-    protected function getCwpProxy()
49
-    {
50
-        if (!Environment::getEnv('SS_OUTBOUND_PROXY') || !Environment::getEnv('SS_OUTBOUND_PROXY_PORT')) {
51
-            return '';
52
-        }
43
+	/**
44
+	 * Returns a formatted CWP proxy string, e.g. `tcp://proxy.cwp.govt.nz:1234`
45
+	 *
46
+	 * @return string
47
+	 */
48
+	protected function getCwpProxy()
49
+	{
50
+		if (!Environment::getEnv('SS_OUTBOUND_PROXY') || !Environment::getEnv('SS_OUTBOUND_PROXY_PORT')) {
51
+			return '';
52
+		}
53 53
 
54
-        return sprintf(
55
-            'tcp://%s:%d',
56
-            Environment::getEnv('SS_OUTBOUND_PROXY'),
57
-            Environment::getEnv('SS_OUTBOUND_PROXY_PORT')
58
-        );
59
-    }
54
+		return sprintf(
55
+			'tcp://%s:%d',
56
+			Environment::getEnv('SS_OUTBOUND_PROXY'),
57
+			Environment::getEnv('SS_OUTBOUND_PROXY_PORT')
58
+		);
59
+	}
60 60
 }
Please login to merge, or discard this patch.
tests/Report/CwpStatsReportTest.php 1 patch
Indentation   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -11,42 +11,42 @@
 block discarded – undo
11 11
 
12 12
 class CwpStatsReportTest extends SapphireTest
13 13
 {
14
-    protected static $fixture_file = 'CwpStatsReportTest.yml';
15
-
16
-    protected function setUp()
17
-    {
18
-        Config::modify()->set(SiteTree::class, 'create_default_pages', false);
19
-
20
-        parent::setUp();
21
-    }
22
-
23
-    public function testCount()
24
-    {
25
-        // Publish all pages apart from page3.
26
-        $this->objFromFixture(Page::class, 'page1')->publishRecursive();
27
-        $this->objFromFixture(Page::class, 'page2')->publishRecursive();
28
-        $this->objFromFixture(Page::class, 'page3')->publishRecursive();
29
-
30
-        // Add page5s to a subsite, if the module is installed.
31
-        $page5s = $this->objFromFixture(Page::class, 'page5s');
32
-        if (class_exists(Subsite::class)) {
33
-            $subsite = Subsite::create();
34
-            $subsite->Title = 'subsite';
35
-            $subsite->write();
36
-
37
-            $page5s->SubsiteID = $subsite->ID;
38
-            $page5s->write();
39
-        }
40
-        $page5s->publishRecursive();
41
-
42
-        $report = CwpStatsReport::create();
43
-        $records = $report->sourceRecords([])->toArray();
44
-        $i = 0;
45
-        $this->assertEquals(4, $records[$i++]['Count'], 'Four pages in total, across locales, subsites, live only.');
46
-        if (class_exists(Subsite::class)) {
47
-            $this->assertEquals(3, $records[$i++]['Count'], 'Three pages in the main site, if subsites installed.');
48
-            $this->assertEquals(1, $records[$i++]['Count'], 'One page in the subsite, if subsites installed');
49
-        }
50
-        $this->assertEquals(1, $records[$i++]['Count'], 'One file in total.');
51
-    }
14
+	protected static $fixture_file = 'CwpStatsReportTest.yml';
15
+
16
+	protected function setUp()
17
+	{
18
+		Config::modify()->set(SiteTree::class, 'create_default_pages', false);
19
+
20
+		parent::setUp();
21
+	}
22
+
23
+	public function testCount()
24
+	{
25
+		// Publish all pages apart from page3.
26
+		$this->objFromFixture(Page::class, 'page1')->publishRecursive();
27
+		$this->objFromFixture(Page::class, 'page2')->publishRecursive();
28
+		$this->objFromFixture(Page::class, 'page3')->publishRecursive();
29
+
30
+		// Add page5s to a subsite, if the module is installed.
31
+		$page5s = $this->objFromFixture(Page::class, 'page5s');
32
+		if (class_exists(Subsite::class)) {
33
+			$subsite = Subsite::create();
34
+			$subsite->Title = 'subsite';
35
+			$subsite->write();
36
+
37
+			$page5s->SubsiteID = $subsite->ID;
38
+			$page5s->write();
39
+		}
40
+		$page5s->publishRecursive();
41
+
42
+		$report = CwpStatsReport::create();
43
+		$records = $report->sourceRecords([])->toArray();
44
+		$i = 0;
45
+		$this->assertEquals(4, $records[$i++]['Count'], 'Four pages in total, across locales, subsites, live only.');
46
+		if (class_exists(Subsite::class)) {
47
+			$this->assertEquals(3, $records[$i++]['Count'], 'Three pages in the main site, if subsites installed.');
48
+			$this->assertEquals(1, $records[$i++]['Count'], 'One page in the subsite, if subsites installed');
49
+		}
50
+		$this->assertEquals(1, $records[$i++]['Count'], 'One file in total.');
51
+	}
52 52
 }
Please login to merge, or discard this patch.