Merge pull request #196 from robbieaverill/bugfix/fix-ci-builds

FIX Fix CI builds, remove excessive Travis builds matrixes, update composer constraint for gridfield-bulk-tools
This commit is contained in:
Daniel Hensby 2017-01-27 10:42:02 +00:00 committed by GitHub
commit 5181ac8be3
7 changed files with 29 additions and 32 deletions

View File

@ -66,4 +66,4 @@ checks:
argument_type_checks: true
filter:
paths: [code/*, tests/*]
paths: [src/*, tests/*]

View File

@ -1,7 +1,5 @@
language: php
sudo: true
addons:
apt:
packages:
@ -18,43 +16,33 @@ before_install:
env:
global:
- DB=MYSQL CORE_RELEASE=master
- MODULE_PATH=comments
# Set to 1 in the matrix to enable code coverage
- COVERAGE=0
- DB=MYSQL CORE_RELEASE=4
matrix:
include:
- php: 5.6
#CommentsListTest breaks with this env: DB=MYSQL CORE_RELEASE=3.2 COVERAGE=1
env: DB=SQLITE CORE_RELEASE=master COVERAGE=1
- php: 5.6
env: DB=MYSQL CORE_RELEASE=master
- php: 7.0
env: DB=MYSQL CORE_RELEASE=master
- php: 7.1
env: DB=MYSQL CORE_RELEASE=master
env: DB=MYSQL CORE_RELEASE=4 COVERAGE=1
- php: 5.6
env: DB=PGSQL CORE_RELEASE=master
env: DB=PGSQL CORE_RELEASE=4
- php: 5.6
env: DB=SQLITE CORE_RELEASE=4
before_script:
- phpenv rehash
- composer self-update || true
- git clone git://github.com/silverstripe-labs/silverstripe-travis-support.git ~/travis-support
- git clone git://github.com/silverstripe/silverstripe-travis-support.git ~/travis-support
# Install suggested modules in order to maximize test coverage
- php ~/travis-support/travis_setup.php --source `pwd` --target ~/builds/ss --require "ezyang/htmlpurifier:4.*,silverstripe/cms:^4.0@dev"
- cd ~/builds/ss
script:
# Execute tests with no coverage. This is the fastest option
- "if [ \"$COVERAGE\" = \"0\" ]; then vendor/bin/phpunit $MODULE_PATH/tests/; fi"
- "if [ \"$COVERAGE\" != \"1\" ]; then vendor/bin/phpunit comments/tests/; fi"
# Execute tests with coverage. Do this for a small
- "if [ \"$COVERAGE\" = \"1\" ]; then vendor/bin/phpunit --coverage-clover=coverage.clover $MODULE_PATH/tests/; fi"
- "if [ \"$COVERAGE\" = \"1\" ]; then vendor/bin/phpunit --coverage-clover=coverage.clover comments/tests/; fi"
after_script:
after_success:
- "if [ \"$COVERAGE\" = \"1\" ]; then mv coverage.clover ~/build/$TRAVIS_REPO_SLUG/; fi"
- cd ~/build/$TRAVIS_REPO_SLUG
- wget https://scrutinizer-ci.com/ocular.phar
- "if [ \"$COVERAGE\" = \"1\" ]; then travis_retry codecov && travis_retry php ocular.phar code-coverage:upload --format=php-clover coverage.clover; fi"
- "if [ \"$COVERAGE\" = \"1\" ]; then travis_retry codecov; fi"

View File

@ -9,7 +9,7 @@
}],
"require": {
"silverstripe/framework": "^4.0@dev",
"colymba/gridfield-bulk-editing-tools": "~2.1"
"colymba/gridfield-bulk-editing-tools": "^3.0"
},
"suggest": {
"ezyang/htmlpurifier": "Standards compliant HTML filter written in PHP",
@ -29,5 +29,7 @@
"SilverStripe\\Comments\\Tests\\": "tests/"
}
},
"license": "BSD-3-Clause"
"license": "BSD-3-Clause",
"minimum-stability": "dev",
"prefer-stable": true
}

View File

@ -24,7 +24,7 @@ class CommentingControllerTest extends FunctionalTest
/**
* {@inheritDoc}
*/
public static $fixture_file = 'CommentsTest.yml';
protected static $fixture_file = 'CommentsTest.yml';
/**
* {@inheritDoc}

View File

@ -18,7 +18,7 @@ class CommentsExtensionTest extends SapphireTest
/**
* {@inheritDoc}
*/
public static $fixture_file = 'comments/tests/CommentsTest.yml';
protected static $fixture_file = 'comments/tests/CommentsTest.yml';
/**
* {@inheritDoc}

View File

@ -6,6 +6,7 @@ use SilverStripe\Comments\Admin\CommentsGridField;
use SilverStripe\Comments\Admin\CommentsGridFieldAction;
use SilverStripe\Comments\Admin\CommentsGridFieldConfig;
use SilverStripe\Comments\Model\Comment;
use SilverStripe\Comments\Tests\Stubs\CommentableItem;
use SilverStripe\Control\Controller;
use SilverStripe\Dev\SapphireTest;
use SilverStripe\Forms\FieldList;
@ -17,6 +18,8 @@ use SilverStripe\ORM\DataObject;
class CommentsGridFieldActionTest extends SapphireTest
{
protected $usesDatabase = true;
/** @var ArrayList */
protected $list;
@ -116,10 +119,16 @@ class CommentsGridFieldActionTest extends SapphireTest
public function testHandleAction()
{
$this->logInWithPermission('CMS_ACCESS_CommentAdmin');
$item = new CommentableItem;
$item->write();
$action = new CommentsGridFieldAction();
$record = new Comment();
$record->Name = 'Name of commenter';
$record->Comment = 'This is a comment';
$record->ParentID = $item->ID;
$record->ParentClass = $item->class;
$record->write();
$recordID = $record->ID;
$arguments = array('RecordID' => $recordID);

View File

@ -24,9 +24,7 @@ use SilverStripe\Security\Permission;
*/
class CommentsTest extends FunctionalTest
{
public static $fixture_file = 'comments/tests/CommentsTest.yml';
protected static $fixture_file = 'comments/tests/CommentsTest.yml';
protected $extraDataObjects = array(
CommentableItem::class,
@ -461,7 +459,7 @@ class CommentsTest extends FunctionalTest
// Without HTML allowed
$comment1 = new Comment();
$comment1->AllowHtml = false;
$comment1->BaseClass = CommentableItem::class;
$comment1->ParentClass = CommentableItem::class;
$comment1->Comment = '<p><script>alert("w00t")</script>my comment</p>';
$comment1->write();
$this->assertEquals(
@ -502,7 +500,7 @@ class CommentsTest extends FunctionalTest
$comment->Comment = '<p>my comment</p>';
$comment->AllowHtml = false;
$comment->ParentID = $item->ID;
$comment->BaseClass = CommentableItem::class;
$comment->ParentClass = CommentableItem::class;
$comment->write();
$html = $item->customise(array('CommentsEnabled' => true))->renderWith('CommentsInterface');