Skip to content

Commit 78d7671

Browse files
authored
Merge pull request #2 from leviy/travis-ci
Set up Travis CI to run a quick test
2 parents 1bd4fa1 + 9fde548 commit 78d7671

File tree

4 files changed

+64
-0
lines changed

4 files changed

+64
-0
lines changed

.travis.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
language: php
2+
3+
php:
4+
- 7.1
5+
- 7.2
6+
7+
cache:
8+
directories:
9+
- $HOME/.composer/cache
10+
11+
install: composer install
12+
13+
script: vendor/bin/phpcs --standard=src/LEVIY/ruleset.xml --basepath=. --report-file=phpcs.log --report-width=120 tests/; diff tests/expected.log phpcs.log

tests/Bar.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
declare(strict_types = 1);
4+
5+
namespace Bar;
6+
7+
use \DateTime;
8+
9+
class Bar
10+
{
11+
const NOW = 'now';
12+
13+
public function getDate() : DateTime
14+
{
15+
$now = strtolower(self::NOW);
16+
17+
return new DateTime($now);
18+
}
19+
}

tests/Foo.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
declare(strict_types=1);
3+
4+
namespace Bar;
5+
6+
use DateTime;
7+
8+
class Foo
9+
{
10+
private const NOW = 'now';
11+
12+
public function getDate(): DateTime
13+
{
14+
return new DateTime(self::NOW);
15+
}
16+
}

tests/expected.log

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
2+
FILE: tests/Bar.php
3+
----------------------------------------------------------------------------------------------------------------------
4+
FOUND 6 ERRORS AFFECTING 5 LINES
5+
----------------------------------------------------------------------------------------------------------------------
6+
3 | ERROR | [x] Expected 1 newlines between PHP open tag and declare statement, found 2.
7+
3 | ERROR | [x] Expected strict_types=1, found strict_types = 1.
8+
7 | ERROR | [x] Use statement cannot start with a backslash.
9+
11 | ERROR | [ ] Constant \Bar\Bar::NOW visibility missing.
10+
13 | ERROR | [x] There must be no whitespace between closing parenthesis and return type colon.
11+
15 | ERROR | [x] Function strtolower() should not be referenced via a fallback global name, but via a use statement.
12+
----------------------------------------------------------------------------------------------------------------------
13+
PHPCBF CAN FIX THE 5 MARKED SNIFF VIOLATIONS AUTOMATICALLY
14+
----------------------------------------------------------------------------------------------------------------------
15+
16+

0 commit comments

Comments
 (0)