Skip to content

Commit

Permalink
Update Github Action implementation. Fix missing dependency (#86)
Browse files Browse the repository at this point in the history
* Update location of main github action config

* Update missing dependency

* Enable code cov report. Update README badge

* Update linting
  • Loading branch information
chrispenny authored Oct 21, 2021
1 parent f9dd486 commit 76d22a8
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/ci.yml → .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ jobs:
ci:
uses: silverstripe/github-actions-ci-cd/.github/workflows/[email protected]
with:
run_phplinting: false
run_phpcoverage: true
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Embargo/Expiry Module

[![Build Status](http://img.shields.io/travis/silverstripe-terraformers/silverstripe-embargo-expiry.svg?style=flat)](https://travis-ci.org/silverstripe-terraformers/silverstripe-embargo-expiry)
![example workflow](https://github.com/silverstripe-terraformers/silverstripe-embargo-expiry/actions/workflows/main.yml/badge.svg)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/silverstripe-terraformers/silverstripe-embargo-expiry/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/silverstripe-terraformers/silverstripe-embargo-expiry/?branch=master)
[![codecov](https://codecov.io/gh/silverstripe-terraformers/silverstripe-embargo-expiry/branch/master/graph/badge.svg)](https://codecov.io/gh/silverstripe-terraformers/silverstripe-embargo-expiry)

Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
"silverstripe/vendor-plugin": "^1.0",
"silverstripe/framework": "^4@dev",
"silverstripe/cms": "^4@dev",
"symbiote/silverstripe-queuedjobs": "^4.0.0"
"symbiote/silverstripe-queuedjobs": "^4.0.0",
"jeremeamia/superclosure": "^2.4"
},
"require-dev": {
"phpunit/phpunit": "^5.7",
Expand Down
39 changes: 39 additions & 0 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<ruleset name="SilverStripe">
<description>CodeSniffer ruleset for SilverStripe coding conventions.</description>

<file>src</file>
<file>tests</file>

<!-- base rules are PSR-2 -->
<rule ref="PSR2" >
<!-- Current exclusions -->
<exclude name="PSR1.Methods.CamelCapsMethodName" />
<exclude name="PSR1.Files.SideEffects.FoundWithSymbols" />
<exclude name="PSR2.Classes.PropertyDeclaration" />
<exclude name="PSR2.ControlStructures.SwitchDeclaration" /> <!-- causes php notice while linting -->
<exclude name="PSR2.ControlStructures.SwitchDeclaration.WrongOpenercase" />
<exclude name="PSR2.ControlStructures.SwitchDeclaration.WrongOpenerdefault" />
<exclude name="PSR2.ControlStructures.SwitchDeclaration.TerminatingComment" />
<exclude name="PSR2.Methods.MethodDeclaration.Underscore" />
<exclude name="Squiz.Scope.MethodScope" />
<exclude name="Squiz.Classes.ValidClassName.NotCamelCaps" />
<exclude name="Generic.Files.LineLength.TooLong" />
<exclude name="PEAR.Functions.ValidDefaultValue.NotAtEnd" />
</rule>

<rule ref="Squiz.Strings.ConcatenationSpacing">
<properties>
<property name="spacing" value="1" />
<property name="ignoreNewlines" value="true"/>
</properties>
</rule>

<!-- use short array syntax (less thirdparty) -->
<rule ref="Generic.Arrays.DisallowLongArraySyntax">
<exclude-pattern>/thirdparty/*</exclude-pattern>
</rule>

<!-- include php files only -->
<arg name="extensions" value="php,lib,inc,php5"/>
</ruleset>
2 changes: 1 addition & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<phpunit bootstrap="vendor/silverstripe/cms/tests/bootstrap.php" colors="true">
<phpunit bootstrap="vendor/silverstripe/framework/tests/bootstrap.php" colors="true">
<testsuite name="Default">
<directory>tests/php/</directory>
</testsuite>
Expand Down
16 changes: 8 additions & 8 deletions tests/php/Extension/EmbargoExpiryCMSMainExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,12 @@ public function testRemoveEmbargoAction(): void
// Post a request to remove the embargo date.
$this->post(
sprintf('admin/pages/edit/EditForm/%s', $id),
array(
[
'ClassName' => SiteTree::class,
'ID' => $id,
'action_removeEmbargoAction' => 1,
'ajax' => 1,
)
]
);

// Refetch object from DB.
Expand All @@ -102,12 +102,12 @@ public function testRemoveExpiryAction(): void
// Post a request to remove the embargo date.
$this->post(
sprintf('admin/pages/edit/EditForm/%s', $id),
array(
[
'ClassName' => SiteTree::class,
'ID' => $id,
'action_removeExpiryAction' => 1,
'ajax' => 1,
)
]
);

// Refetch object from DB.
Expand All @@ -124,12 +124,12 @@ public function testRemoveActionFailsRecordDoesNotExist(): void
// Post a request to remove the embargo date.
$response = $this->post(
'admin/pages/edit/EditForm/99',
array(
[
'ClassName' => SiteTree::class,
'ID' => 99,
'action_removeEmbargoAction' => 1,
'ajax' => 1,
)
]
);

$this->assertEquals(404, $response->getStatusCode());
Expand All @@ -151,12 +151,12 @@ public function testRemoveActionFailsPermissionDenied(): void
// Post a request to remove the embargo date.
$this->post(
sprintf('admin/pages/edit/EditForm/%s', $id),
array(
[
'ClassName' => SiteTree::class,
'ID' => $id,
'action_removeExpiryAction' => 1,
'ajax' => 1,
)
]
);
}
}
2 changes: 1 addition & 1 deletion tests/php/Extension/EmbargoExpiryExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ public function testAddDesiredDateFieldsWithoutPermission(): void
$this->assertNotNull($publishField);
$this->assertTrue($publishField->isReadonly());
$this->assertNotNull($unPublishField);
$this->assertTrue($unPublishField->isReadonly());;
$this->assertTrue($unPublishField->isReadonly());
}

public function testAddScheduledDateFieldsWithoutPermission(): void
Expand Down

0 comments on commit 76d22a8

Please sign in to comment.