PluginProbe
GetResponse Forms by Optin Cat / 1.3.5
GetResponse Forms by Optin Cat v1.3.5
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-0.0.15 / tests / ApiTest.php

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

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