Updated PHPUnit config

Added phpcs config

Added GitHub Actions badge

Re-organized tests folder
This commit is contained in:
UndefinedOffset 2022-02-16 15:25:43 -04:00
parent c965eb0c2e
commit e1b1bbf8b3
No known key found for this signature in database
GPG Key ID: 59C4EE2B6468B796
12 changed files with 95 additions and 9 deletions

View File

@ -90,7 +90,7 @@ jobs:
- name: Perform PHPUnit Tests
env:
SS_DATABASE_PORT: ${{ job.services.mysql.ports['3306'] }}
run: vendor/bin/phpunit --colors=always --printer UndefinedOffset\\SortableGridField\\Tests\\Bootstrap\\GitHubActionsAnnotatorPrinter
run: vendor/bin/phpunit --colors=always --printer UndefinedOffset\\SortableGridField\\Tests\\PHPUnit\\Bootstrap\\GitHubActionsAnnotatorPrinter
silverstripe_410_php80:
name: "Silverstripe 4.10 | PHP 8.0"
@ -167,7 +167,7 @@ jobs:
- name: Perform PHPUnit Tests
env:
SS_DATABASE_PORT: ${{ job.services.mysql.ports['3306'] }}
run: vendor/bin/phpunit --colors=always --printer UndefinedOffset\\SortableGridField\\Tests\\Bootstrap\\GitHubActionsAnnotatorPrinter
run: vendor/bin/phpunit --colors=always --printer UndefinedOffset\\SortableGridField\\Tests\\PHPUnit\\Bootstrap\\GitHubActionsAnnotatorPrinter
silverstripe_49_php74:
name: "Silverstripe 4.9 | PHP 7.4"
@ -244,7 +244,7 @@ jobs:
- name: Perform PHPUnit Tests
env:
SS_DATABASE_PORT: ${{ job.services.mysql.ports['3306'] }}
run: vendor/bin/phpunit --colors=always --printer UndefinedOffset\\SortableGridField\\Tests\\Bootstrap\\GitHubActionsAnnotatorPrinter
run: vendor/bin/phpunit --colors=always --printer UndefinedOffset\\SortableGridField\\Tests\\PHPUnit\\Bootstrap\\GitHubActionsAnnotatorPrinter
phpcs:
name: "PHP_CodeSniffer"

View File

@ -1,7 +1,7 @@
SortableGridField
=================
[![Build Status](https://travis-ci.org/UndefinedOffset/SortableGridField.png)](https://travis-ci.org/UndefinedOffset/SortableGridField)
[![CI](https://github.com/UndefinedOffset/SortableGridField/actions/workflows/ci.yml/badge.svg)](https://github.com/UndefinedOffset/SortableGridField/actions/workflows/ci.yml)
Adds drag and drop functionality to SilverStripe 4's GridField

49
phpcs.xml.dist Normal file
View File

@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<ruleset name="SilverStripe">
<description>CodeSniffer ruleset for SilverStripe coding conventions.</description>
<!-- 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.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" />
<exclude name="PSR2.ControlStructures.ElseIfDeclaration" />
</rule>
<rule ref="Squiz.Strings.ConcatenationSpacing">
<properties>
<property name="spacing" value="1" />
<property name="ignoreNewlines" value="true"/>
</properties>
</rule>
<rule ref="PEAR.ControlStructures.MultiLineCondition" />
<rule ref="Generic.Formatting.SpaceAfterCast" />
<rule ref="Generic.Arrays.DisallowLongArraySyntax.Found">
<type>warning</type>
</rule>
<rule ref="Squiz.Arrays.ArrayDeclaration.NoComma" />
<rule ref="Squiz.WhiteSpace.OperatorSpacing">
<properties>
<property name="ignoreNewlines" value="true" />
</properties>
</rule>
<rule ref="PSR12.Functions.ReturnTypeDeclaration" />
<!-- include php files only -->
<arg name="extensions" value="php,lib,inc,php5"/>
<file>./src</file>
<file>./tests</file>
<file>./_config.php</file>
</ruleset>

View File

@ -1,5 +1,27 @@
<phpunit bootstrap="vendor/silverstripe/framework/tests/bootstrap.php" colors="true">
<testsuite name="Default">
<directory>tests/</directory>
</testsuite>
<?xml version="1.0"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/silverstripe/framework/tests/bootstrap.php" colors="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<testsuites>
<testsuite name="Default">
<directory suffix=".php">tests/PHPUnit</directory>
</testsuite>
</testsuites>
<groups>
<exclude>
<group>sanitychecks</group>
</exclude>
</groups>
<coverage includeUncoveredFiles="true">
<include>
<directory suffix=".php">src/</directory>
</include>
<exclude>
<directory suffix=".php">tests/</directory>
</exclude>
</coverage>
<php>
<get name="flush" value="1"/>
</php>
</phpunit>

View File

@ -1,5 +1,5 @@
<?php
namespace UndefinedOffset\SortableGridField\Tests\Bootstrap;
namespace UndefinedOffset\SortableGridField\Tests\PHPUnit\Bootstrap;
use PHPUnit\Framework\TestFailure;
use PHPUnit\TextUI\DefaultResultPrinter;

View File

@ -0,0 +1,15 @@
SS_ENVIRONMENT_TYPE="dev"
SS_TRUSTED_PROXY_IPS="*"
SS_DATABASE_CLASS="MySQLPDODatabase"
SS_DATABASE_SERVER="127.0.0.1"
SS_DATABASE_USERNAME="root"
SS_DATABASE_PASSWORD="testpassword"
SS_DATABASE_NAME="test_db"
SS_DEFAULT_ADMIN_USERNAME="username"
SS_DEFAULT_ADMIN_PASSWORD="password"
SS_ERROR_LOG="artifacts/silverstripe-errors.log"
TRAVIS_TEST_SESSION="1"