Skip to content

Commit

Permalink
Add Travis configuration, phpcs and phpunit configuration, new build …
Browse files Browse the repository at this point in the history
…badges in readme
  • Loading branch information
robbieaverill committed Aug 8, 2017
1 parent 7c280d8 commit bced835
Show file tree
Hide file tree
Showing 5 changed files with 97 additions and 33 deletions.
35 changes: 30 additions & 5 deletions .travis.yml
@@ -1,7 +1,32 @@
sudo: false

language: php

branches:
except:
develop
env:
global:
- COMPOSER_ROOT_VERSION=4.0.x-dev

matrix:
include:
- php: 5.6
env: DB=MYSQL PHPCS_TEST=1 PHPUNIT_TEST=1
- php: 7.0
env: DB=MYSQL PHPUNIT_TEST=1
- php: 7.1
env: DB=MYSQL PHPUNIT_COVERAGE_TEST=1

before_script:
# Init PHP
- phpenv rehash
- phpenv config-rm xdebug.ini

# Install composer dependencies
- composer install --prefer-dist
- composer require --prefer-dist --no-update silverstripe/framework:4.0.x-dev silverstripe/cms:4.0.x-dev silverstripe/admin:1.0.x-dev silverstripe/versioned:1.0.x-dev
- composer update

script:
- if [[ $PHPUNIT_TEST ]]; then vendor/bin/phpunit tests/php; fi
- if [[ $PHPUNIT_COVERAGE_TEST ]]; then phpdbg -qrr vendor/bin/phpunit --coverage-clover=coverage.xml tests/php; fi
- if [[ $PHPCS_TEST ]]; then vendor/bin/phpcs src/ tests/; fi

after_success:
- if [[ $PHPUNIT_COVERAGE_TEST ]]; then bash <(curl -s https://codecov.io/bash) -f coverage.xml; fi
52 changes: 28 additions & 24 deletions composer.json
@@ -1,31 +1,35 @@
{
"name": "tractorcow/silverstripe-fluent",
"description": "Simple localisation for Silverstripe",
"type": "silverstripe-module",
"keywords": [
"name": "tractorcow/silverstripe-fluent",
"description": "Simple localisation for Silverstripe",
"type": "silverstripe-module",
"keywords": [
"silverstripe", "localisation", "localization", "translation", "language", "locale", "multilingual",
"translatable", "i18n", "internationalisation", "internationalization"
],
"license": "BSD-3-Clause",
"authors": [
{
"name": "Damian Mooyman",
"email": "damian.mooyman@gmail.com"
}
],
"support": {
"issues": "http://github.com/tractorcow/silverstripe-fluent/issues"
},
"require": {
"silverstripe/framework": "^4@dev",
"silverstripe/cms": "^4@dev"
},
"extra": {
"branch-alias": {
"dev-develop": "4.0.x-dev"
},
"installer-name": "fluent"
},
"license": "BSD-3-Clause",
"authors": [
{
"name": "Damian Mooyman",
"email": "damian.mooyman@gmail.com"
}
],
"support": {
"issues": "http://github.com/tractorcow/silverstripe-fluent/issues"
},
"require": {
"silverstripe/framework": "^4@dev",
"silverstripe/cms": "^4@dev"
},
"require-dev": {
"phpunit/phpunit": "^5.7",
"squizlabs/php_codesniffer": "*"
},
"extra": {
"branch-alias": {
"dev-develop": "4.0.x-dev"
},
"installer-name": "fluent"
},
"autoload": {
"psr-4": {
"TractorCow\\Fluent\\": "src/",
Expand Down
22 changes: 22 additions & 0 deletions phpcs.xml.dist
@@ -0,0 +1,22 @@
<?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.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>
</ruleset>

13 changes: 13 additions & 0 deletions phpunit.xml.dist
@@ -0,0 +1,13 @@
<phpunit bootstrap="cms/tests/bootstrap.php" colors="true">
<testsuite name="Default">
<directory>tests/php/</directory>
</testsuite>
<filter>
<whitelist addUncoveredFilesFromWhitelist="true">
<directory suffix=".php">src/</directory>
<exclude>
<directory suffix=".php">tests/</directory>
</exclude>
</whitelist>
</filter>
</phpunit>
8 changes: 4 additions & 4 deletions readme.md
@@ -1,8 +1,8 @@
# Fluent

[![Build Status](https://travis-ci.org/tractorcow/silverstripe-fluent.svg?branch=master)](https://travis-ci.org/tractorcow/silverstripe-fluent)

[![Codewake](https://www.codewake.com/badges/ask_question.svg)](https://www.codewake.com/p/silverstripe-fluent)
[![Build Status](https://travis-ci.org/tractorcow/silverstripe-fluent.svg?branch=develop)](https://travis-ci.org/tractorcow/silverstripe-fluent)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/tractorcow/silverstripe-fluent/badges/quality-score.png?b=develop)](https://scrutinizer-ci.com/g/tractorcow/silverstripe-fluent/?branch=develop)
[![codecov](https://codecov.io/gh/tractorcow/silverstripe-fluent/branch/develop/graph/badge.svg)](https://codecov.io/gh/tractorcow/silverstripe-fluent)

## Simple Silverstripe Localisation

Expand All @@ -14,7 +14,7 @@ Locales are distinguished by a url prefix, that of the selected locale, at the s
of all page links. E.g. `http://damian.geek.nz/en_NZ/about-me` would be the NZ English
version of a page. This could be localised into Maori at `http://damian.geek.nz/mi_NZ/about-me`

Fluent also integrates nicely with Google Sitemaps module, linking localisations for each page as per
Fluent also integrates nicely with Google Sitemaps module, linking localisations for each page as per
[Google's internationalisation guidelines](https://support.google.com/webmasters/answer/182192?hl=en&ref_topic=2370587)

Fluent also supports the use of multiple domains to assist in locale filtering
Expand Down

0 comments on commit bced835

Please sign in to comment.