Skip to content

Commit bd8d0b0

Browse files
Merge branch 'first_tests' into connect_travis
# Conflicts: # .travis.yml
2 parents 9c20c5e + 8d43daf commit bd8d0b0

File tree

6 files changed

+26
-16
lines changed

6 files changed

+26
-16
lines changed

.travis.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
language: php
1+
language: "php"
2+
php:
3+
- "5.6"
4+
- "7.0.4"
5+
- "hhvm"
26

3-
matrix:
4-
include:
5-
- php: 5.6
6-
- php: 7.0
7-
- php: hhvm
7+
before_script:
8+
- "composer install --no-progress --no-interaction"
89

910
script:
1011
- "php bin/phpunit -c phpunit.xml --colors=always --verbose --coverage-clover=coverage.xml"

composer.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525
"tests/shared-enviroment/IntegrationTestSuite.php"
2626
]
2727
},
28+
"config": {
29+
"bin-dir": "bin/"
30+
},
2831
"require": {
2932
"php": ">= 5.6.0 || 7.0.0 - 7.0.4 || >= 7.0.6",
3033
"leafo/lessphp": "^0.5",

src/Container/File.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class File
1111
const TYPE_SASS = 'sass';
1212
const TYPE_SCSS = 'scss';
1313
const TYPE_LESS = 'less';
14-
const SUPPORTED_TYPES = [
14+
static $supportedTypes = [
1515
self::TYPE_COMPASS,
1616
self::TYPE_SASS,
1717
self::TYPE_SCSS,
@@ -179,7 +179,7 @@ protected function detectSourceTypeFromPath($path)
179179
{
180180
$extension = strtolower(pathinfo($path, PATHINFO_EXTENSION));
181181

182-
return in_array($extension, static::SUPPORTED_TYPES)
182+
return in_array($extension, static::$supportedTypes)
183183
? $extension
184184
: static::TYPE_UNKNOWN;
185185
}

src/Processor/Processor.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class Processor
1616
const FORMATTER_EXPANDED = 'expanded';
1717
const FORMATTER_NESTED = 'nested';
1818
const FORMATTER_COMPACT = 'compact';
19-
const SUPPORTED_FORMATTERS = [
19+
static $supportedFormatters = [
2020
self::FORMATTER_COMPRESSED,
2121
self::FORMATTER_CRUNCHED,
2222
self::FORMATTER_EXPANDED,
@@ -167,8 +167,8 @@ public function processFile(File $file)
167167
*/
168168
protected function getFormatterClass($formatter)
169169
{
170-
if (!in_array($formatter, static::SUPPORTED_FORMATTERS)) {
171-
throw new \InvalidArgumentException('unknown formatter, available options are: ' . print_r(static::SUPPORTED_FORMATTERS, true));
170+
if (!in_array($formatter, static::$supportedFormatters)) {
171+
throw new \InvalidArgumentException('unknown formatter, available options are: ' . print_r(static::$supportedFormatters, true));
172172
}
173173

174174
return 'Leafo\\ScssPhp\\Formatter\\' . ucfirst($formatter);

tests/phpunit/ProcessorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public function processFileExpectedException()
9393
*/
9494
public function getFormatterClass()
9595
{
96-
foreach (Processor::SUPPORTED_FORMATTERS as $formatter) {
96+
foreach (Processor::$supportedFormatters as $formatter) {
9797
$expected = 'Leafo\\ScssPhp\\Formatter\\' . ucfirst($formatter);
9898

9999
$this->assertEquals(

tests/shared-enviroment/IntegrationTestSuite.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,26 @@ abstract class IntegrationTestSuite extends \PHPUnit_Framework_TestCase
1919
* @return mixed
2020
* @throws \Exception
2121
*/
22-
protected function invokeMethod($object, string $methodName, array $methodArguments = [])
22+
protected function invokeMethod($object, $methodName, array $methodArguments = [])
2323
{
2424
$method = (new \ReflectionClass(get_class($object)))->getMethod($methodName);
2525
$method->setAccessible(true);
2626

2727
return $method->invokeArgs($object, $methodArguments);
2828
}
2929

30-
public static function getRootDirectory() : string
30+
/**
31+
* @return string
32+
*/
33+
public static function getRootDirectory()
3134
{
3235
return dirname(__DIR__);
3336
}
3437

35-
public static function getSharedFixturesDirectory() : string
38+
/**
39+
* @return string
40+
*/
41+
public static function getSharedFixturesDirectory()
3642
{
3743
return static::getRootDirectory() . '/shared-fixtures';
3844
}
@@ -44,7 +50,7 @@ public static function getSharedFixturesDirectory() : string
4450
*
4551
* @return string
4652
*/
47-
public static function getSharedFixtureContent(string $filename) : string
53+
public static function getSharedFixtureContent(string $filename)
4854
{
4955
return file_get_contents(static::getSharedFixturesDirectory() . "/$filename");
5056
}

0 commit comments

Comments
 (0)