Merge pull request #26 from assertchris/clean-up-tests-and-badges

Cleaned up tests and Badges
This commit is contained in:
Damian Mooyman 2015-11-02 09:28:24 +13:00
commit f9aec74a41
5 changed files with 36 additions and 89 deletions

View File

@ -1,71 +1,9 @@
filter: inherit: true
excluded_paths:
- 'vendor/*'
- 'tests/*'
- 'bin/*'
- 'library/*'
paths: [ 'timeline/*']
tools:
js_hint: true
php_analyzer:
enabled: true
extensions:
- php
filter:
excluded_paths:
- 'vendor/*'
- 'tests/*'
- 'bin/*'
paths: { }
path_configs: { }
php_cpd:
enabled: true
excluded_dirs: { }
names:
- '*.php'
min_lines: 5
min_tokens: 70
filter:
excluded_paths:
- 'vendor/*'
- 'tests/*'
- 'app/*'
- 'bin/*'
paths: { }
php_pdepend:
enabled: true
configuration_file: null
suffixes:
- php
excluded_dirs: { }
filter:
excluded_paths:
- 'vendor/*'
- 'tests/*'
- 'app/*'
- 'bin/*'
paths: { }
external_code_coverage:
enabled: true
timeout: 300
filter:
excluded_paths:
- 'vendor/*'
- 'tests/*'
- 'app/*'
- 'bin/*'
paths: { }
sensiolabs_security_checker: true
php_loc:
enabled: true
excluded_dirs: [vendor, tests]
changetracking: checks:
bug_patterns: php:
- '\bfix(?:es|ed)?\b' code_rating: true
feature_patterns: duplication: true
- '\badd(?:s|ed)?\b'
- '\bimplement(?:s|ed)?\b' filter:
before_commands: { } paths: [code/*, tests/*]
after_commands: { }
artifacts: { }

View File

@ -1,24 +1,32 @@
# See https://github.com/silverstripe-labs/silverstripe-travis-support for setup details # See https://github.com/silverstripe-labs/silverstripe-travis-support for setup details
language: php sudo: false
php:
- 5.3
env: language: php
- DB=MYSQL CORE_RELEASE=3.1
- DB=PGSQL CORE_RELEASE=3.1 php:
- 5.3
- 5.4
- 5.5
- 5.6
env: DB=MYSQL CORE_RELEASE=3.2
matrix: matrix:
include: include:
- php: 5.4 - php: 5.6
env: DB=MYSQL CORE_RELEASE=3.1 env: DB=MYSQL CORE_RELEASE=3.1
- php: 5.6
env: DB=PGSQL CORE_RELEASE=3.1
- php: 5.6
env: DB=PGSQL CORE_RELEASE=3.2
before_script: before_script:
- git clone git://github.com/silverstripe-labs/silverstripe-travis-support.git ~/travis-support - composer self-update || true
- php ~/travis-support/travis_setup.php --source `pwd` --target ~/builds/ss --require silverstripe/cms - git clone git://github.com/silverstripe-labs/silverstripe-travis-support.git ~/travis-support
- cd ~/builds/ss - php ~/travis-support/travis_setup.php --source `pwd` --target ~/builds/ss
- cd ~/builds/ss
- composer install
script: script:
- phpunit --coverage-clover=coverage.clover - phpunit contentreview/tests
- wget https://scrutinizer-ci.com/ocular.phar
- php ocular.phar code-coverage:upload --format=php-clover coverage.clover --repository=g/silverstripe-labs/silverstripe-contentreview --revision=`cd contentreview && git rev-parse HEAD`

View File

@ -1,8 +1,9 @@
# Content Review module # Content Review module
[![Build Status](https://travis-ci.org/silverstripe-labs/silverstripe-contentreview.png?branch=feature_improvements)](https://travis-ci.org/silverstripe-labs/silverstripe-contentreview) [![Build Status](http://img.shields.io/travis/silverstripe/silverstripe-contentreview.svg?style=flat-square)](https://travis-ci.org/silverstripe/silverstripe-contentreview)
[![Scrutinizer Quality Score](https://scrutinizer-ci.com/g/silverstripe-labs/silverstripe-contentreview/badges/quality-score.png?s=e68f2c583f03c7eab0326781f6219f0ed58c9ad8)](https://scrutinizer-ci.com/g/silverstripe-labs/silverstripe-contentreview/) [![Code Quality](http://img.shields.io/scrutinizer/g/silverstripe/silverstripe-contentreview.svg?style=flat-square)](https://scrutinizer-ci.com/g/silverstripe/silverstripe-contentreview)
[![Code Coverage](https://scrutinizer-ci.com/g/silverstripe-labs/silverstripe-contentreview/badges/coverage.png?s=42151d66ef5121363face01c03c94dc479baa408)](https://scrutinizer-ci.com/g/silverstripe-labs/silverstripe-contentreview/) [![Version](http://img.shields.io/packagist/v/silverstripe/contentreview.svg?style=flat-square)](https://packagist.org/packages/silverstripe/silverstripe-contentreview)
[![License](http://img.shields.io/packagist/l/silverstripe/contentreview.svg?style=flat-square)](LICENSE.md)
This module helps keep your website content accurate and up-to-date, which keeps your users happy. This module helps keep your website content accurate and up-to-date, which keeps your users happy.

View File

@ -27,7 +27,7 @@ class ContentReviewCMSExtension extends LeftAndMainExtension {
if(!isset($data['ID'])) { if(!isset($data['ID'])) {
throw new SS_HTTPResponse_Exception("No record ID", 404); throw new SS_HTTPResponse_Exception("No record ID", 404);
} }
$SQL_id = Convert::raw2sql($data['ID']); $SQL_id = (int) $data['ID'];
$record = SiteTree::get()->byID($SQL_id); $record = SiteTree::get()->byID($SQL_id);
if(!$record || !$record->ID) { if(!$record || !$record->ID) {
@ -67,7 +67,7 @@ class ContentReviewCMSExtension extends LeftAndMainExtension {
if(!isset($data['ID'])) { if(!isset($data['ID'])) {
throw new SS_HTTPResponse_Exception("No record ID", 404); throw new SS_HTTPResponse_Exception("No record ID", 404);
} }
$SQL_id = Convert::raw2sql($data['ID']); $SQL_id = (int) $data['ID'];
$page = SiteTree::get()->byID($SQL_id); $page = SiteTree::get()->byID($SQL_id);
if($page && !$page->canEdit()) { if($page && !$page->canEdit()) {
return Security::permissionFailure(); return Security::permissionFailure();

View File

@ -20,7 +20,7 @@ class ContentReviewCMSPageEditControllerTest extends ContentReviewBaseTest {
} }
public function testReviewedThrowsExceptionWithWrongRecordID() { public function testReviewedThrowsExceptionWithWrongRecordID() {
$this->setExpectedException('SS_HTTPResponse_Exception', 'Bad record ID #FAIL', 404); $this->setExpectedException('SS_HTTPResponse_Exception');
$controller = new CMSPageEditController(); $controller = new CMSPageEditController();
$dummyForm = new CMSForm($controller, 'EditForm', new FieldList(), new FieldList()); $dummyForm = new CMSForm($controller, 'EditForm', new FieldList(), new FieldList());
$controller->reviewed(array('ID'=>'FAIL', 'Message' => null), $dummyForm); $controller->reviewed(array('ID'=>'FAIL', 'Message' => null), $dummyForm);