PluginProbe
Responsive Menu – Create Mobile-Friendly Menu / 3.0.6
Responsive Menu – Create Mobile-Friendly Menu v3.0.6
4.7.3 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 4.0.0 4.0.1 4.0.2 4.0.3 4.0.4 4.1.0 4.1.1 4.1.10 4.1.11 4.1.12 4.1.2 4.1.3 4.1.4 4.1.5 4.1.6 4.1.7 4.1.8 4.1.9 4.2.0 All 90 releases
responsive-menu / src / app / Mappers / scssphp / tests / ExceptionTest.php

ExceptionTest.php in Responsive Menu – Create Mobile-Friendly Menu 3.0.6, at src/app/Mappers/scssphp/tests/ExceptionTest.php

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