vendor/leafo/scssphp/tests/InputTest.php
(开头部分) 2KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
require_once __DIR__ . "/../scss.inc.php";
// Runs all the tests in inputs/ and compares their output to ouputs/
function _dump($value) {
fwrite(STDOUT, print_r($value, true));
}
function _quote($str) {
return preg_quote($str, "/");
}
class InputTest extends PHPUnit_Framework_TestCase {
protected static $inputDir = "inputs";
protected static $outputDir = "outputs";
public function setUp() {
$this->scss = new scssc();
$this->scss->addImportPath(__DIR__ . "/" . self::$inputDir);
}
/**
* @dataProvider fileNameProvider
*/
public function testInputFile($inFname, $outFname) {
if (getenv("BUILD")) {
return $this->buildInput($inFname,$outFname);
}
if (!is_readable($outFname)) {
$this->fail("$outFname is missing, ".
"consider building tests with BUILD=true");
}
$input = file_get_contents($inFname);
$output = file_get_contents($outFname);
$this->assertEquals($output, $this->scss->compile($input));
}
public function fileNameProvider() {
return array_map(function($a) { return array($a, InputTest::outputNameFor($a)); },
self::findInputNames());
}
// only run when env is set
public function buildInput($inFname, $outFname) {
$css = $this->scss->compile(file_get_contents($inFname));
file_put_contents($outFname, $css);
}
static public function findInputNames($pattern="*") {
$files = glob(__DIR__ . "/" . self::$inputDir . "/" . $pattern);
$files = array_filter($files, "is_file");
if ($pattern = getenv("MATCH")) {
$files = array_filter($files, function($fname) use ($pattern) {
return preg_match("/$pattern/", $fname);
});
后面还有 23 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
