Skip to content

Commit

Permalink
Merge pull request #21 from silverleague/feature/support-php55
Browse files Browse the repository at this point in the history
Support PHP 5.5. Reduce to PHPUnit 4.8. Add roles to readme. Update Travis configuration.
  • Loading branch information
robbieaverill authored Jan 31, 2017
2 parents 340296c + f05a2b7 commit fa5c75e
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 49 deletions.
27 changes: 17 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,33 @@
language: php

php:
- 5.5
- 5.6
- 7.0
- 7.1

env:
- DB=MYSQL CORE_RELEASE=4
- DB=PGSQL CORE_RELEASE=4

matrix:
include:
- php: 7.1
env: DB=MYSQL CORE_RELEASE=4 COVERAGE="--coverage-clover=coverage.xml"
- php: 7.1
env: DB=PGSQL CORE_RELEASE=4

before_script:
- composer self-update || true
- composer install
- "if [ \"$DB\" = \"PGSQL\" ]; then composer require silverstripe/postgresql:2.0.x-dev --prefer-dist; fi"
- curl https://phar.phpunit.de/phpunit-5.7.5.phar > ./phpunit
- chmod +x ./phpunit
- git clone git://github.com/silverstripe/silverstripe-travis-support.git ~/travis-support
- php ~/travis-support/travis_setup.php --source `pwd` --target ~/builds/ss
- cd ~/builds/ss

script:
- ./phpunit --coverage-clover=coverage.xml
- vendor/bin/phpunit "$COVERAGE" logviewer/tests

# Share coverage results with codecov.io
after_success:
- mv coverage.xml ~/build/$TRAVIS_REPO_SLUG
- cd ~/build/$TRAVIS_REPO_SLUG
- bash <(curl -s https://codecov.io/bash)
- >
test "$COVERAGE" != ""
&& mv coverage.xml ~/build/$TRAVIS_REPO_SLUG
&& cd ~/build/$TRAVIS_REPO_SLUG
&& bash <(curl -s https://codecov.io/bash)
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Show your SilverStripe log entries in the CMS.

## Requirements

* PHP 5.6+
* PHP 5.5+
* SilverStripe ^4.0
* Composer

Expand Down Expand Up @@ -83,6 +83,12 @@ If you encounter a problem with our module then please let us know by raising an

Ensure you tell us which version of this module you are using, as well as which versions of PHP and SilverStripe framework you are using. If you aren't sure, you can find out by running the following commands from your command line: `php -v`, `composer show silverleague/logviewer` and `composer show silverstripe/framework`.

| Role | Name |
| ------------- | ------------------------------------------------- |
| Maintainer | [robbieaverill](https://github.com/robbieaverill) |
| Co-maintainer | TBC |
| Advocate | TBC |

## Contributing

Please see [the contributing guide](CONTRIBUTING.md) for more information.
5 changes: 4 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"type": "silverstripe-module",
"homepage": "https://github.com/silverleague/silverstripe-logviewer",
"license": "MIT",
"keywords": ["silverstripe", "cms", "log", "monolog"],
"keywords": ["silverstripe", "error", "cms", "log", "monolog"],
"authors": [
{
"name": "Robbie Averill",
Expand All @@ -17,6 +17,9 @@
"monolog/monolog": "~1.11",
"silverstripe/crontask": "2.x-dev"
},
"require-dev": {
"phpunit/phpunit": "^4.8"
},
"autoload": {
"psr-4": {
"SilverLeague\\LogViewer\\": "src/",
Expand Down
1 change: 0 additions & 1 deletion phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
<directory suffix=".php">src/</directory>
<exclude>
<directory suffix=".php">tests/</directory>
<file>tests/bootstrap.php</file>
</exclude>
</whitelist>
</filter>
Expand Down
3 changes: 2 additions & 1 deletion src/Handler/DataObjectHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Monolog\Logger;
use Monolog\Formatter\LineFormatter;
use Monolog\Handler\AbstractProcessingHandler;
use SilverLeague\LogViewer\Model\LogEntry;
use SilverStripe\Core\Config\Config;

/**
Expand All @@ -22,7 +23,7 @@ class DataObjectHandler extends AbstractProcessingHandler
*
* @var string
*/
const DEFAULT_CLASS = 'SilverLeague\\LogViewer\\Model\\LogEntry';
const DEFAULT_CLASS = LogEntry::class;

/**
* The default DateTime format to use for storing the log timestamp
Expand Down
1 change: 1 addition & 0 deletions src/Model/LogEntry.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ public function canEdit($member = null)
{
return false;
}

/**
* {@inheritdoc}
*/
Expand Down
3 changes: 1 addition & 2 deletions src/Task/RemoveOldLogEntriesTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ class RemoveOldLogEntriesTask extends BuildTask implements CronTask
/**
* {@inheritDoc}
*/
protected $description = 'Removes LogEntry records that are older than the configured '
. '`LogViewer.max_log_age` setting. Will run as a cron task unless disabled via configuration.';
protected $description = 'Removes LogEntry records that are older than the configured `LogViewer.max_log_age`.';

/**
* BuildTask implementation
Expand Down
2 changes: 1 addition & 1 deletion tests/Task/RemoveOldLogEntriesTaskTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function testClassProperties()
{
$task = new RemoveOldLogEntriesTask;
$this->assertContains('Remove LogEntry', $task->getTitle());
$this->assertContains('Will run as a cron task', $task->getDescription());
$this->assertContains('that are older than', $task->getDescription());
$this->assertSame('RemoveOldLogEntriesTask', Config::inst()->get(RemoveOldLogEntriesTask::class, 'segment'));
}

Expand Down
32 changes: 0 additions & 32 deletions tests/bootstrap.php

This file was deleted.

0 comments on commit fa5c75e

Please sign in to comment.