-
Notifications
You must be signed in to change notification settings - Fork 90
Expand file tree
/
Copy pathFrameworkTest.php
More file actions
125 lines (95 loc) · 3.56 KB
/
FrameworkTest.php
File metadata and controls
125 lines (95 loc) · 3.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
<?php
/**
* SCSSPHP
*
* @copyright 2012-2020 Leaf Corcoran
*
* @license http://opensource.org/licenses/MIT MIT
*
* @link http://scssphp.github.io/scssphp
*/
namespace ScssPhp\ScssPhp\Tests;
use PHPUnit\Framework\TestCase;
use ScssPhp\ScssPhp\Compiler;
use ScssPhp\ScssPhp\Logger\QuietLogger;
/**
* @group frameworks
*/
class FrameworkTest extends TestCase
{
public function testBootstrap()
{
$compiler = new Compiler();
$compiler->setLogger(new QuietLogger());
$compiler->setSourceMap(Compiler::SOURCE_MAP_INLINE);
$entrypoint = dirname(__DIR__) . '/vendor/twbs/bootstrap/scss/bootstrap.scss';
$result = $compiler->compileFile($entrypoint);
$this->assertNotEmpty($result->getCss());
}
public function testBootstrap4()
{
$compiler = new Compiler();
$compiler->setLogger(new QuietLogger());
$compiler->setSourceMap(Compiler::SOURCE_MAP_INLINE);
$entrypoint = dirname(__DIR__) . '/vendor/twbs/bootstrap4/scss/bootstrap.scss';
$result = $compiler->compileFile($entrypoint);
$this->assertNotEmpty($result->getCss());
}
public function testBootstrap4CustomSettings()
{
$compiler = new Compiler();
$compiler->addImportPath(dirname(__DIR__) . '/vendor/twbs/bootstrap4/scss');
$compiler->setLogger(new QuietLogger());
$compiler->setSourceMap(Compiler::SOURCE_MAP_INLINE);
$scss = <<<'SCSS'
$enable-shadows: true;
$enable-gradients: true;
@import "bootstrap";
SCSS;
$result = $compiler->compileString($scss);
$this->assertNotEmpty($result->getCss());
}
public function testFoundation()
{
$compiler = new Compiler();
$compiler->setLogger(new QuietLogger());
$compiler->setSourceMap(Compiler::SOURCE_MAP_INLINE);
$entrypoint = dirname(__DIR__) . '/vendor/zurb/foundation/assets/foundation.scss';
$result = $compiler->compileFile($entrypoint);
$this->assertNotEmpty($result->getCss());
}
/**
* @dataProvider provideBourbonEntrypoints
*/
public function testBourbon($entrypoint)
{
$compiler = new Compiler();
$compiler->setLogger(new QuietLogger());
$compiler->setSourceMap(Compiler::SOURCE_MAP_INLINE);
$compiler->addImportPath(dirname(__DIR__) . '/vendor/thoughtbot/bourbon');
$compiler->addImportPath(dirname(__DIR__) . '/vendor/thoughtbot/bourbon/spec/fixtures');
$result = $compiler->compileFile($entrypoint);
$this->assertNotEmpty($result->getCss());
}
public static function provideBourbonEntrypoints()
{
$baseDir = dirname(__DIR__) . '/vendor/thoughtbot/bourbon/spec/fixtures';
$iterator = new \RecursiveDirectoryIterator($baseDir, \FilesystemIterator::SKIP_DOTS);
$iterator = new \RecursiveCallbackFilterIterator($iterator, function (\SplFileInfo $current) {
return $current->isDir() || $current->getFilename()[0] !== '_';
});
/** @var \SplFileInfo $file */
foreach (new \RecursiveIteratorIterator($iterator) as $file) {
yield substr($file->getRealPath(), strlen($baseDir) + 1) => [$file->getRealPath()];
}
}
public function testBulma(): void
{
$compiler = new Compiler();
$compiler->setLogger(new QuietLogger());
$compiler->setSourceMap(Compiler::SOURCE_MAP_INLINE);
$entrypoint = \dirname(__DIR__) . '/vendor/jgthms/bulma/bulma.sass';
$result = $compiler->compileFile($entrypoint);
$this->assertNotEmpty($result->getCss());
}
}