Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 3963baa

Browse files
Merge branch 'master' into improve-tests
2 parents d1d4444 + b9760c9 commit 3963baa

File tree

3 files changed

+31
-18
lines changed

3 files changed

+31
-18
lines changed

‎.scrutinizer.yml‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,9 @@ build:
1212
php:
1313
version: "7.0.4"
1414
tests:
15-
override:
16-
-
17-
command: "composer validate"
1815
override:
1916
-
2017
command: "php bin/phpunit -c phpunit.xml --colors=always --verbose --coverage-clover=coverage.xml"
2118
coverage:
2219
file: "coverage.xml"
23-
format: "php-clover"
20+
format: "clover"

‎src/Processor/Processor.php‎

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
use EM\CssCompiler\Container\FileContainer;
77
use EM\CssCompiler\Exception\CompilerException;
88
use EM\CssCompiler\Exception\FileException;
9-
use Leafo\ScssPhp\Compiler as SASSCompiler;
9+
use Leafo\ScssPhp\Compiler as SCSSCompiler;
1010
use Leafo\ScssPhp\Exception\ParserException;
1111
use lessc as LESSCompiler;
1212
use scss_compass as CompassCompiler;
@@ -39,9 +39,9 @@ class Processor
3939
*/
4040
private $files = [];
4141
/**
42-
* @var SASSCompiler
42+
* @var SCSSCompiler
4343
*/
44-
private $sass;
44+
private $scss;
4545
/**
4646
* @var LESSCompiler
4747
*/
@@ -50,15 +50,10 @@ class Processor
5050
public function __construct(IOInterface $io)
5151
{
5252
$this->io = $io;
53-
$this->initCompilers();
54-
}
55-
56-
protected function initCompilers()
57-
{
5853
$this->less = new LESSCompiler();
59-
$this->sass = new SASSCompiler();
60-
/** attaches compass functionality to the SASS compiler */
61-
new CompassCompiler($this->sass);
54+
$this->scss = new SCSSCompiler();
55+
/** attaches compass functionality to the SCSS compiler */
56+
new CompassCompiler($this->scss);
6257
}
6358

6459
/**
@@ -132,7 +127,7 @@ public function saveOutput()
132127
*/
133128
public function processFiles($formatter)
134129
{
135-
$this->sass->setFormatter($this->getFormatterClass($formatter));
130+
$this->scss->setFormatter($this->getFormatterClass($formatter));
136131
$this->io->write("<info>use '{$formatter}' formatting</info>");
137132

138133
foreach ($this->files as $file) {
@@ -174,8 +169,8 @@ public function processFile(FileContainer $file)
174169
protected function compileSCSS(FileContainer $file)
175170
{
176171
try {
177-
$this->sass->addImportPath(dirname($file->getInputPath()));
178-
$content = $this->sass->compile($file->getInputContent());
172+
$this->scss->addImportPath(dirname($file->getInputPath()));
173+
$content = $this->scss->compile($file->getInputContent());
179174

180175
return $file->setOutputContent($content);
181176
} catch (ParserException $e) {

‎tests/phpunit/Processor/ProcessorTest.php‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,4 +247,25 @@ private function processFiles($input, $output)
247247

248248
return $processor->getFiles();
249249
}
250+
251+
/**
252+
* @see ScriptHandler::processFiles
253+
* @test
254+
*/
255+
public function saveOutput()
256+
{
257+
$processor = new Processor($this->io);
258+
259+
$expectedOutputFile = $this->getRootDirectory() . '/../var/tests/' . __FUNCTION__ . '.css';
260+
@unlink($expectedOutputFile);
261+
$processor->attachFiles(
262+
$this->getSharedFixturesDirectory() . '/scss',
263+
$expectedOutputFile
264+
);
265+
$processor->processFiles(Processor::FORMATTER_COMPRESSED);
266+
267+
$processor->saveOutput();
268+
269+
$this->assertFileExists($expectedOutputFile);
270+
}
250271
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /