Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 5 additions & 71 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,77 +1,11 @@
# https://help.github.com/en/categories/automating-your-workflow-with-github-actions
name: CI

on:
push:
branches: [ '**' ]
pull_request:
branches: [ '**' ]

name: "CI"
workflow_dispatch:

jobs:
tests:
name: "Tests"

runs-on: "ubuntu-latest"

env:
php_extensions: ctype, dom, fileinfo, hash, intl, mbstring, session, simplexml, tokenizer, xml, pdo, mysqli, gd, zip

services:
mysql:
image: "mysql:5.7"
env:
MYSQL_ALLOW_EMPTY_PASSWORD: true
MYSQL_ROOT_PASSWORD:
MYSQL_DATABASE: test_db
ports:
- 3306/tcp
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3

strategy:
fail-fast: false
matrix:
php-version:
- "8.0"
- "8.1"

steps:
- name: "Checkout"
uses: "actions/checkout@v2"

- name: "Install PHP with extensions"
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-version }}"
extensions: "${{ env.php_extensions }}"
coverage: "xdebug"

- name: "Start mysql service"
run: "sudo /etc/init.d/mysql start"

- name: "Cache dependencies installed with composer"
uses: "actions/cache@v1"
with:
path: "~/.composer/cache"
key: "php${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.json') }}"
restore-keys: "php${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-"

- name: "Install dependencies with composer"
run: "composer install --no-ansi --no-interaction --no-progress"

- name: "Require Silverstripe CMS for PHPUnit bootstrap"
run: "composer require silverstripe/cms"

- name: "Run tests with phpunit/phpunit --coverage-clover=coverage.xml"
env:
SS_DATABASE_PORT: ${{ job.services.mysql.ports['3306'] }}
run: "vendor/bin/phpunit"

- name: "Upload coverage results to CodeCov"
uses: codecov/codecov-action@v1
with:
files: ./coverage.xml # optional
flags: unittests # optional

- name: "Run tests with squizlabs/php_codesniffer"
run: "vendor/bin/phpcs -s --report=summary --standard=phpcs.xml.dist --extensions=php,inc --ignore=autoload.php --ignore=vendor/ src/ tests/"
ci:
name: CI
uses: silverstripe/gha-ci/.github/workflows/ci.yml@v1
15 changes: 0 additions & 15 deletions .scrutinizer.yml

This file was deleted.

39 changes: 0 additions & 39 deletions .travis.yml

This file was deleted.

16 changes: 9 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "dynamic/silverstripe-salsify",
"description": "Salsify integration for SilverStripe websites.",
"license": "BSD-3-Clause",
"type": "silverstripe-vendormodule",
"keywords": [
"silverstripe",
Expand All @@ -9,14 +10,17 @@
"PXM",
"PIM"
],
"license": "BSD-3-Clause",
"require": {
"silverstripe/framework": "^5.0",
"halaxa/json-machine": "^1.0"
"halaxa/json-machine": "^1.0",
"silverstripe/framework": "^5.0"
},
"require-dev": {
"silverstripe/recipe-testing": "^3.0"
"silverstripe/recipe-testing": "^3",
"silverstripe/standards": "^1",
"squizlabs/php_codesniffer": "^3"
},
"minimum-stability": "dev",
"prefer-stable": true,
"autoload": {
"psr-4": {
"Dynamic\\Salsify\\": "src/",
Expand All @@ -30,7 +34,5 @@
"silverstripe/vendor-plugin": true
},
"process-timeout": 600
},
"minimum-stability": "dev",
"prefer-stable": true
}
}
19 changes: 7 additions & 12 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
<?xml version="1.0"?>
<ruleset name="SS4">
<description>Coding standard for SilverStripe 4.x</description>
<?xml version="1.0" encoding="UTF-8"?>
<ruleset name="Silverstripe">
<description>CodeSniffer ruleset for Silverstripe coding conventions.</description>

<!-- Don't sniff third party libraries -->
<exclude-pattern>*/vendor/*</exclude-pattern>
<exclude-pattern>*/thirdparty/*</exclude-pattern>
<file>src</file>
<file>tests</file>

<!-- Show progress and output sniff names on violation, and add colours -->
<arg value="sp"/>
<arg name="colors"/>

<!-- Use PSR-2 as a base standard -->
<rule ref="PSR2">
<!-- base rules are PSR-12 -->
<rule ref="PSR12" >
<!-- Allow classes to not declare a namespace -->
<exclude name="PSR1.Classes.ClassDeclaration.MissingNamespace"/>

Expand Down
26 changes: 14 additions & 12 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
<phpunit bootstrap="vendor/silverstripe/cms/tests/bootstrap.php" colors="true">
<testsuite name="silverstripe-shopify">
<directory>tests/</directory>
</testsuite>

<filter>
<whitelist addUncoveredFilesFromWhitelist="true">
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/silverstripe/cms/tests/bootstrap.php" colors="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage includeUncoveredFiles="true">
<include>
<directory suffix=".php">src/</directory>
<exclude>
<directory suffix=".php">tests/</directory>
</exclude>
</whitelist>
</filter>
</include>
<exclude>
<directory suffix=".php">tests/</directory>
</exclude>
</coverage>
<testsuites>
<testsuite name="default">
<directory>tests/</directory>
</testsuite>
</testsuites>
</phpunit>
3 changes: 1 addition & 2 deletions src/Model/Fetcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,10 @@
*/
class Fetcher extends Service
{

/**
* @var string
*/
const API_BASE_URL = 'https://app.salsify.com/api/';
protected const API_BASE_URL = 'https://app.salsify.com/api/';

/**
* @var string
Expand Down
1 change: 0 additions & 1 deletion src/Model/Mapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
*/
class Mapper extends Service
{

/**
* @var bool
*/
Expand Down
1 change: 0 additions & 1 deletion src/Model/MapperHash.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
*/
class MapperHash extends DataObject
{

/**
* @var string
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Model/Service.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function __construct($importerKey)
foreach ($this->yieldKeyVal($serviceConfig) as $key => $value) {
if (!is_array($value)) {
$this->config()->set($key, $value);
}else{
} else {
$this->config()->merge($key, $value);
}

Expand Down
1 change: 0 additions & 1 deletion src/ORM/FileDataExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/
class FileDataExtension extends DataExtension
{

/**
* @var array
*/
Expand Down
1 change: 0 additions & 1 deletion src/ORM/ImageDataExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/
class ImageDataExtension extends DataExtension
{

/**
* @var array
*/
Expand Down
1 change: 0 additions & 1 deletion src/ORM/SalsifyIDExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
*/
class SalsifyIDExtension extends DataExtension
{

/**
* @var array
*/
Expand Down
1 change: 0 additions & 1 deletion src/Traits/Yieldable.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
*/
trait Yieldable
{

/**
* @var string
*/
Expand Down
1 change: 0 additions & 1 deletion src/TypeHandler/Asset/AssetHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
*/
class AssetHandler extends Extension
{

/**
* @param $id
* @return array
Expand Down
1 change: 0 additions & 1 deletion src/TypeHandler/Asset/FileHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
*/
class FileHandler extends AssetHandler
{

/**
* @var array
*/
Expand Down
1 change: 0 additions & 1 deletion src/TypeHandler/Asset/ImageHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
*/
class ImageHandler extends AssetHandler
{

/**
* @var array
*/
Expand Down
1 change: 0 additions & 1 deletion src/TypeHandler/RawHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
*/
class RawHandler extends Extension
{

/**
* @var array
*/
Expand Down
1 change: 0 additions & 1 deletion src/TypeHandler/Relation/ManyHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
*/
class ManyHandler extends Extension
{

/**
* @var array
*/
Expand Down
1 change: 0 additions & 1 deletion tests/Model/FetcherTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
*/
class FetcherTest extends SapphireTest
{

/**
* @var string
*/
Expand Down
1 change: 0 additions & 1 deletion tests/Model/ImporterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/
class ImporterTest extends SapphireTest
{

/**
*
*/
Expand Down
1 change: 0 additions & 1 deletion tests/Model/MapperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
*/
class MapperTest extends SapphireTest
{

/**
* @var string
*/
Expand Down