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 argument_type_checks: true
filter: filter:
paths: [code/*, tests/*] paths: [src/*, tests/*]

View File

@ -1,7 +1,5 @@
language: php language: php
sudo: true
addons: addons:
apt: apt:
packages: packages:
@ -18,43 +16,33 @@ before_install:
env: env:
global: global:
- DB=MYSQL CORE_RELEASE=master - DB=MYSQL CORE_RELEASE=4
- MODULE_PATH=comments
# Set to 1 in the matrix to enable code coverage
- COVERAGE=0
matrix: matrix:
include: 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 - php: 7.1
env: DB=MYSQL CORE_RELEASE=master env: DB=MYSQL CORE_RELEASE=4 COVERAGE=1
- php: 5.6 - 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: before_script:
- phpenv rehash - phpenv rehash
- composer self-update || true - 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 # 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" - php ~/travis-support/travis_setup.php --source `pwd` --target ~/builds/ss --require "ezyang/htmlpurifier:4.*,silverstripe/cms:^4.0@dev"
- cd ~/builds/ss - cd ~/builds/ss
script: script:
# Execute tests with no coverage. This is the fastest option # 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 # 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" - "if [ \"$COVERAGE\" = \"1\" ]; then mv coverage.clover ~/build/$TRAVIS_REPO_SLUG/; fi"
- cd ~/build/$TRAVIS_REPO_SLUG - cd ~/build/$TRAVIS_REPO_SLUG
- wget https://scrutinizer-ci.com/ocular.phar - "if [ \"$COVERAGE\" = \"1\" ]; then travis_retry codecov; fi"
- "if [ \"$COVERAGE\" = \"1\" ]; then travis_retry codecov && travis_retry php ocular.phar code-coverage:upload --format=php-clover coverage.clover; fi"

View File

@ -9,7 +9,7 @@
}], }],
"require": { "require": {
"silverstripe/framework": "^4.0@dev", "silverstripe/framework": "^4.0@dev",
"colymba/gridfield-bulk-editing-tools": "~2.1" "colymba/gridfield-bulk-editing-tools": "^3.0"
}, },
"suggest": { "suggest": {
"ezyang/htmlpurifier": "Standards compliant HTML filter written in PHP", "ezyang/htmlpurifier": "Standards compliant HTML filter written in PHP",
@ -29,5 +29,7 @@
"SilverStripe\\Comments\\Tests\\": "tests/" "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} * {@inheritDoc}
*/ */
public static $fixture_file = 'CommentsTest.yml'; protected static $fixture_file = 'CommentsTest.yml';
/** /**
* {@inheritDoc} * {@inheritDoc}

View File

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

View File

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

View File

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