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 / ExceptionTest.php

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

94 lines 1.8 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 ExceptionTest extends \PHPUnit_Framework_TestCase
8 {
9 public function setUp()
10 {
11 $this->scss = new Compiler();
12 }
13
14 /**
15 * @param string $scss
16 * @param string $expectedExceptionMessage
17 *
18 * @dataProvider provideScss
19 */
20 public function testThrowError($scss, $expectedExceptionMessage)
21 {
22 try {
23 $this->compile($scss);
24 } catch (\Exception $e) {
25 if (strpos($e->getMessage(), $expectedExceptionMessage) !== false) {
26 return;
27 };
28 }
29
30 $this->fail('Expected exception to be raised: ' . $expectedExceptionMessage);
31 }
32
33 /**
34 * @return array
35 */
36 public function provideScss()
37 {
38 return array(
39 array(<<<END_OF_SCSS
40 .test {
41 foo : bar;
42 END_OF_SCSS
43 ,
44 'unclosed block'
45 ),
46 array(<<<END_OF_SCSS
47 .test {
48 }}
49 END_OF_SCSS
50 ,
51 'unexpected }'
52 ),
53 array(<<<END_OF_SCSS
54 .test { color: #fff / 0; }
55 END_OF_SCSS
56 ,
57 'color: Can\'t divide by zero'
58 ),
59 array(<<<END_OF_SCSS
60 .test {
61 @include foo();
62 }
63 END_OF_SCSS
64 ,
65 'Undefined mixin foo'
66 ),
67 array(<<<END_OF_SCSS
68 @mixin do-nothing() {
69 }
70
71 .test {
72 @include do-nothing(\$a: "hello");
73 }
74 END_OF_SCSS
75 ,
76 'Mixin or function doesn\'t have an argument named $a.'
77 ),
78 array(<<<END_OF_SCSS
79 div {
80 color: darken(cobaltgreen, 10%);
81 }
82 END_OF_SCSS
83 ,
84 'expecting color'
85 ),
86 );
87 }
88
89 private function compile($str)
90 {
91 return trim($this->scss->compile($str));
92 }
93 }
94