Update Travis configuration to be standalone, add codecov.io, update license year
This commit is contained in:
parent
b757c3dc6d
commit
a60f592598
40
.travis.yml
40
.travis.yml
|
@ -1,33 +1,31 @@
|
||||||
# See https://github.com/silverstripe/silverstripe-travis-support for setup details
|
|
||||||
|
|
||||||
sudo: false
|
|
||||||
|
|
||||||
language: php
|
language: php
|
||||||
|
|
||||||
php:
|
|
||||||
- 5.3
|
|
||||||
- 5.4
|
|
||||||
- 5.5
|
|
||||||
|
|
||||||
env:
|
env:
|
||||||
- DB=MYSQL CORE_RELEASE=3.5
|
global:
|
||||||
|
- COMPOSER_ROOT_VERSION="4.0.x-dev"
|
||||||
|
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- php: 5.6
|
- php: 5.6
|
||||||
env: DB=MYSQL CORE_RELEASE=3
|
env: DB=MYSQL PHPCS_TEST=1 PHPUNIT_TEST=1
|
||||||
- php: 5.6
|
- php: 7.0
|
||||||
env: DB=MYSQL CORE_RELEASE=3.1
|
env: DB=PGSQL PHPUNIT_TEST=1
|
||||||
- php: 5.6
|
|
||||||
env: DB=PGSQL CORE_RELEASE=3.2
|
|
||||||
- php: 7.1
|
- php: 7.1
|
||||||
env: DB=MYSQL CORE_RELEASE=3.6
|
env: DB=MYSQL PHPUNIT_COVERAGE_TEST=1
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
- composer self-update || true
|
- phpenv rehash
|
||||||
- git clone git://github.com/silverstripe/silverstripe-travis-support.git ~/travis-support
|
- phpenv config-rm xdebug.ini
|
||||||
- php ~/travis-support/travis_setup.php --source `pwd` --target ~/builds/ss --require silverstripe/userforms
|
|
||||||
- cd ~/builds/ss
|
- composer install --prefer-dist
|
||||||
|
- composer require --prefer-dist --no-update silverstripe/framework:4.0.x-dev
|
||||||
|
- if [[ $DB == PGSQL ]]; then composer require --prefer-dist --no-update silverstripe/postgresql:2.0.x-dev; fi
|
||||||
|
- composer update
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- vendor/bin/phpunit spamprotection/tests
|
- if [[ $PHPUNIT_TEST ]]; then vendor/bin/phpunit tests/; fi
|
||||||
|
- if [[ $PHPUNIT_COVERAGE_TEST ]]; then phpdbg -qrr vendor/bin/phpunit --coverage-clover=coverage.xml; fi
|
||||||
|
- if [[ $PHPCS_TEST ]]; then vendor/bin/phpcs --standard=framework/phpcs.xml.dist src/ tests/ ; fi
|
||||||
|
|
||||||
|
after_success:
|
||||||
|
- if [[ $PHPUNIT_COVERAGE_TEST ]]; then bash <(curl -s https://codecov.io/bash) -f coverage.xml; fi
|
||||||
|
|
37
README.md
37
README.md
|
@ -1,8 +1,7 @@
|
||||||
# SpamProtection Module
|
# SpamProtection Module
|
||||||
|
|
||||||
[![Build Status](https://secure.travis-ci.org/silverstripe/silverstripe-spamprotection.png?branch=master)](http://travis-ci.org/silverstripe/silverstripe-spamprotection)
|
[![Build Status](https://secure.travis-ci.org/silverstripe/silverstripe-spamprotection.png?branch=master)](http://travis-ci.org/silverstripe/silverstripe-spamprotection)
|
||||||
![helpfulrobot](https://helpfulrobot.io/silverstripe/spamprotection/badge)
|
[![Code Coverage](https://codecov.io/gh/silverstripe/silverstripe-spamprotection/branch/master/graph/badge.svg)](https://codecov.io/gh/silverstripe/silverstripe-spamprotection)
|
||||||
|
|
||||||
|
|
||||||
## Maintainer Contact
|
## Maintainer Contact
|
||||||
|
|
||||||
|
@ -18,9 +17,9 @@ SilverStripe 3.0.0 or greater
|
||||||
|
|
||||||
## Documentation
|
## Documentation
|
||||||
|
|
||||||
This module provides a generic, consistent API for adding spam protection to
|
This module provides a generic, consistent API for adding spam protection to
|
||||||
your SilverStripe Forms. This does not provide any spam protection out of the
|
your SilverStripe Forms. This does not provide any spam protection out of the
|
||||||
box, for that, you must also download one of the spam protection
|
box, for that, you must also download one of the spam protection
|
||||||
implementations. Currently available options are:
|
implementations. Currently available options are:
|
||||||
|
|
||||||
* [Mollom](https://github.com/silverstripe/silverstripe-mollom)
|
* [Mollom](https://github.com/silverstripe/silverstripe-mollom)
|
||||||
|
@ -33,8 +32,8 @@ implements the `SpamProtector` interface. More on that below.
|
||||||
|
|
||||||
## Configuring
|
## Configuring
|
||||||
|
|
||||||
After installing this module and a protector of your choice (i.e mollom) you'll
|
After installing this module and a protector of your choice (i.e mollom) you'll
|
||||||
need to rebuild your database through `dev/build` and set the default protector
|
need to rebuild your database through `dev/build` and set the default protector
|
||||||
via SilverStripe's config system. This will update any Form instances that have
|
via SilverStripe's config system. This will update any Form instances that have
|
||||||
spam protection hooks with that protector.
|
spam protection hooks with that protector.
|
||||||
|
|
||||||
|
@ -47,18 +46,18 @@ spam protection hooks with that protector.
|
||||||
default_spam_protector: MollomSpamProtector
|
default_spam_protector: MollomSpamProtector
|
||||||
|
|
||||||
To add spam protection to your form instance call `enableSpamProtection`.
|
To add spam protection to your form instance call `enableSpamProtection`.
|
||||||
|
|
||||||
// your existing form code
|
// your existing form code
|
||||||
$form = new Form( .. );
|
$form = new Form( .. );
|
||||||
$form->enableSpamProtection();
|
$form->enableSpamProtection();
|
||||||
|
|
||||||
The logic to perform the actual spam validation is controlled by each of the
|
The logic to perform the actual spam validation is controlled by each of the
|
||||||
individual `SpamProtector` implementation since they each require a different
|
individual `SpamProtector` implementation since they each require a different
|
||||||
implementation client side or server side.
|
implementation client side or server side.
|
||||||
|
|
||||||
### Options
|
### Options
|
||||||
|
|
||||||
`enableSpamProtection` takes a hash of optional configuration values.
|
`enableSpamProtection` takes a hash of optional configuration values.
|
||||||
|
|
||||||
$form->enableSpamProtection(array(
|
$form->enableSpamProtection(array(
|
||||||
'protector' => 'MathSpamProtector',
|
'protector' => 'MathSpamProtector',
|
||||||
|
@ -67,14 +66,14 @@ implementation client side or server side.
|
||||||
|
|
||||||
Options to configure are:
|
Options to configure are:
|
||||||
|
|
||||||
*`protector`* a class name string or class instance which implements
|
*`protector`* a class name string or class instance which implements
|
||||||
`SpamProtector`. Defaults to your
|
`SpamProtector`. Defaults to your
|
||||||
`FormSpamProtectionExtension.default_spam_protector` value.
|
`FormSpamProtectionExtension.default_spam_protector` value.
|
||||||
|
|
||||||
*`name`* the form field name argument for the Captcha. Defaults to `Catcha`.
|
*`name`* the form field name argument for the Captcha. Defaults to `Catcha`.
|
||||||
*`title`* title of the Captcha form field. Defaults to `''`
|
*`title`* title of the Captcha form field. Defaults to `''`
|
||||||
*`insertBefore`* name of existing field to insert the spam protection field prior to
|
*`insertBefore`* name of existing field to insert the spam protection field prior to
|
||||||
*`mapping`* an array mapping of the Form fields to the standardized list of
|
*`mapping`* an array mapping of the Form fields to the standardized list of
|
||||||
field names. The list of standardized fields to pass to the spam protector are:
|
field names. The list of standardized fields to pass to the spam protector are:
|
||||||
|
|
||||||
title
|
title
|
||||||
|
@ -90,7 +89,7 @@ field names. The list of standardized fields to pass to the spam protector are:
|
||||||
## Defining your own `SpamProtector`
|
## Defining your own `SpamProtector`
|
||||||
|
|
||||||
Any class that implements `SpamProtector` and the `getFormField()` method can
|
Any class that implements `SpamProtector` and the `getFormField()` method can
|
||||||
be set as the spam protector. The `getFormField()` method returns the
|
be set as the spam protector. The `getFormField()` method returns the
|
||||||
`FormField` to be inserted into the `Form`. The `FormField` returned should be
|
`FormField` to be inserted into the `Form`. The `FormField` returned should be
|
||||||
in charge of the validation process.
|
in charge of the validation process.
|
||||||
|
|
||||||
|
@ -110,14 +109,14 @@ in charge of the validation process.
|
||||||
|
|
||||||
This module provides an EditableSpamProtectionField wrapper which you can add
|
This module provides an EditableSpamProtectionField wrapper which you can add
|
||||||
to your UserForm instances. After installing this module and running /dev/build
|
to your UserForm instances. After installing this module and running /dev/build
|
||||||
to rebuild the database, your Form Builder interface will have an option for
|
to rebuild the database, your Form Builder interface will have an option for
|
||||||
`Spam Protection Field`. The type of spam protection used will be based on your
|
`Spam Protection Field`. The type of spam protection used will be based on your
|
||||||
currently selected SpamProtector instance.
|
currently selected SpamProtector instance.
|
||||||
|
|
||||||
## Releasing code with Spam Protection support
|
## Releasing code with Spam Protection support
|
||||||
|
|
||||||
Spam protection is useful to provide but in some cases we do not want to require
|
Spam protection is useful to provide but in some cases we do not want to require
|
||||||
the developer to use spam protection. In that case, modules can provide the
|
the developer to use spam protection. In that case, modules can provide the
|
||||||
following pattern
|
following pattern
|
||||||
|
|
||||||
$form = new Form(..);
|
$form = new Form(..);
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
comment: false
|
|
@ -1,4 +1,4 @@
|
||||||
Copyright (c) 2016, SilverStripe Limited
|
Copyright (c) 2017, SilverStripe Limited
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
<phpunit bootstrap="framework/tests/bootstrap.php" colors="true">
|
||||||
|
<testsuite name="Default">
|
||||||
|
<directory>tests</directory>
|
||||||
|
</testsuite>
|
||||||
|
|
||||||
|
<filter>
|
||||||
|
<whitelist addUncoveredFilesFromWhitelist="true">
|
||||||
|
<directory suffix=".php">src/.</directory>
|
||||||
|
<exclude>
|
||||||
|
<directory suffix=".php">tests/</directory>
|
||||||
|
</exclude>
|
||||||
|
</whitelist>
|
||||||
|
</filter>
|
||||||
|
</phpunit>
|
Loading…
Reference in New Issue