PluginProbe
GetResponse Forms by Optin Cat / 1.3.4
GetResponse Forms by Optin Cat v1.3.4
1.3.4 1.3.5 1.3.6 1.3.8 1.3.9 1.4.0 1.4.1 1.4.2 1.5.0 1.5.1 1.5.2 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.6.1 1.6.2 1.6.3 1.7.0 1.7.1 1.7.2 1.8.0 1.8.1 2.0.0 All 36 releases
getresponse / includes / classes / scssphp / tests / ApiTest.php

ApiTest.php in GetResponse Forms by Optin Cat 1.3.4, at includes/classes/scssphp/tests/ApiTest.php

83 lines 2.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Leafo\ScssPhp\Tests;
4
5 use Leafo\ScssPhp\Compiler;
6
7 class ApiTest extends \PHPUnit_Framework_TestCase
8 {
9 public function setUp()
10 {
11 $this->scss = new Compiler();
12 }
13
14 public function testUserFunction()
15 {
16 $this->scss->registerFunction('add-two', function ($args) {
17 list($a, $b) = $args;
18 return $a[1] + $b[1];
19 });
20
21 $this->assertEquals(
22 'result: 30;',
23 $this->compile('result: add-two(10, 20);')
24 );
25 }
26
27 public function testImportMissing()
28 {
29 $this->assertEquals(
30 '@import "missing";',
31 $this->compile('@import "missing";')
32 );
33 }
34
35 public function testImportCustomCallback()
36 {
37 $this->scss->addImportPath(function ($path) {
38 return __DIR__ . '/inputs/' . str_replace('.css', '.scss', $path);
39 });
40
41 $this->assertEquals(
42 trim(file_get_contents(__DIR__ . '/outputs/variables.css')),
43 $this->compile('@import "variables.css";')
44 );
45 }
46
47 /**
48 * @dataProvider provideSetVariables
49 */
50 public function testSetVariables($expected, $scss, $variables)
51 {
52 $this->scss->setVariables($variables);
53
54 $this->assertEquals($expected, $this->compile($scss));
55 }
56
57 public function provideSetVariables()
58 {
59 return array(
60 array(
61 ".magic {\n color: red;\n width: 760px; }",
62 '.magic { color: $color; width: $base - 200; }',
63 array(
64 'color' => 'red',
65 'base' => '960px',
66 ),
67 ),
68 array(
69 ".logo {\n color: #808080; }",
70 '.logo { color: desaturate($primary, 100%); }',
71 array(
72 'primary' => '#ff0000',
73 ),
74 ),
75 );
76 }
77
78 public function compile($str)
79 {
80 return trim($this->scss->compile($str));
81 }
82 }
83