HEX
Server: nginx
System: Linux pool195-106-36.bur.atomicsites.net 6.12.57+deb12-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.12.57-1~bpo12+1 (2025-11-17) x86_64
User: (0)
PHP: 8.3.32
Disabled: pcntl_fork
Upload Files
File: //srv/htdocs/wp-content/plugins/custom-codes/vendor/kylekatarnls/stylus/tests/Stylus/StylusTest.php
<?php

namespace Stylus\Test;

use Stylus\Stylus;

require('src/Stylus/Exception.php');
require('src/Stylus/Stylus.php');

class StylusTest extends \PHPUnit_Framework_TestCase {

    function testRenderingOfString() {

        $stylus = new Stylus();

        $in = "body\n  color black";
        $out = $stylus->fromString($in)->toString();

        $correct = "body {\n\tcolor: black;\n}\n";

        $this->assertEquals(str_replace("\r", '', $correct), str_replace("\r", '', $out));

    }

    function testBlockParseColonNoSpace(){

        $stylus = new Stylus();

        $in = "body\n  color:black";
        $out = $stylus->fromString($in)->toString();

        $correct = "body {\n\tcolor: black;\n}\n";

        $this->assertEquals(str_replace("\r", '', $correct), str_replace("\r", '', $out));
    }

    function testBlockParseColonWithSpace(){

        $stylus = new Stylus();

        $in = "body\n  color: black";
        $out = $stylus->fromString($in)->toString();

        $correct = "body {\n\tcolor: black;\n}\n";

        $this->assertEquals(str_replace("\r", '', $correct), str_replace("\r", '', $out));
    }

    function testBlockParseSpaceWithColon(){

        $stylus = new Stylus();

        $in = "body\n  color :black";
        $out = $stylus->fromString($in)->toString();

        $correct = "body {\n\tcolor: black;\n}\n";

        $this->assertEquals(str_replace("\r", '', $correct), str_replace("\r", '', $out));
    }

    function testRenderingFromFile() {

        $stylus = new Stylus();

        $stylus->setReadDir('tests/data');

        $in = 'test.styl';
        $out = str_replace("\r", '', $stylus->fromFile($in)->toString());

        $correct = file_get_contents('tests/data/test.css');

        $this->assertEquals($correct, $out);

    }

    function testAnimationsRenderingFromFile() {

        $stylus = new Stylus();

        $stylus->setReadDir('tests/data');

        $in = 'animations.styl';
        $out = str_replace("\r", '', $stylus->fromFile($in)->toString());

        $correct = file_get_contents('tests/data/animations.css');

        $this->assertEquals($correct, $out);

    }

}