Proyectos de Subversion Moodle

Rev

Rev 11 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 11 Rev 1441
Línea 24... Línea 24...
24
 * @package   core
24
 * @package   core
25
 * @category  phpunit
25
 * @category  phpunit
26
 * @copyright 2016 onwards Ankit Agarwal
26
 * @copyright 2016 onwards Ankit Agarwal
27
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
27
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
28
 */
28
 */
29
class scss_test extends \advanced_testcase {
29
final class scss_test extends \advanced_testcase {
Línea 30... Línea 30...
30
 
30
 
31
    /**
31
    /**
32
     * Data provider for is_valid_file
32
     * Data provider for is_valid_file
33
     * @return array
33
     * @return array
34
     */
34
     */
35
    public function is_valid_file_provider() {
35
    public static function is_valid_file_provider(): array {
36
        $themedirectory = \core_component::get_component_directory('theme_boost');
36
        $themedirectory = \core_component::get_component_directory('theme_boost');
37
        $realroot = realpath($themedirectory);
37
        $realroot = realpath($themedirectory);
38
        return [
38
        return [
39
            "File import 1" => [
39
            "File import 1" => [
Línea 64... Línea 64...
64
    }
64
    }
Línea 65... Línea 65...
65
 
65
 
66
    /**
66
    /**
67
     * Test cases for SassC compilation.
67
     * Test cases for SassC compilation.
68
     */
68
     */
69
    public function scss_compilation_provider() {
69
    public static function scss_compilation_provider(): array {
70
        return [
70
        return [
71
            'simple' => [
71
            'simple' => [
72
                'scss' => '$font-stack: Helvetica, sans-serif;
72
                'scss' => '$font-stack: Helvetica, sans-serif;
Línea 130... Línea 130...
130
    /**
130
    /**
131
     * Test that we can use the SassC compiler if it's provided.
131
     * Test that we can use the SassC compiler if it's provided.
132
     *
132
     *
133
     * @dataProvider scss_compilation_provider
133
     * @dataProvider scss_compilation_provider
134
     * @param string $scss The raw scss to compile.
134
     * @param string $scss The raw scss to compile.
135
     * @param string $expectedcss The expected CSS output.
135
     * @param string $expected The expected CSS output.
136
     */
136
     */
137
    public function test_scss_compilation_with_sassc($scss, $expectedcss): void {
137
    public function test_scss_compilation_with_sassc($scss, $expected): void {
138
        if (!defined('PHPUNIT_PATH_TO_SASSC')) {
138
        if (!defined('PHPUNIT_PATH_TO_SASSC')) {
139
            $this->markTestSkipped('Path to SassC not provided');
139
            $this->markTestSkipped('Path to SassC not provided');
140
        }
140
        }
Línea 141... Línea 141...
141
 
141
 
142
        $this->resetAfterTest();
142
        $this->resetAfterTest();
143
        set_config('pathtosassc', PHPUNIT_PATH_TO_SASSC);
143
        set_config('pathtosassc', PHPUNIT_PATH_TO_SASSC);
144
        $compiler = new core_scss();
144
        $compiler = new core_scss();
145
        $this->assertSame($compiler->compile($scss), $expectedcss);
145
        $this->assertSame($compiler->compile($scss), $expected);
146
    }
146
    }