Thomas Bruederli
2013-10-26 fdb30f32790857797ae91520995b02316d2d3673
tests/Framework/Utils.php
@@ -171,6 +171,12 @@
        $this->assertRegExp('/#rcmbody h1\s\{/', $mod, "Prefix tag styles (single)");
        $this->assertRegExp('/#rcmbody h1, #rcmbody h2, #rcmbody h3, #rcmbody textarea\s+\{/', $mod, "Prefix tag styles (multiple)");
        $this->assertRegExp('/#rcmbody \.noscript\s+\{/', $mod, "Prefix class styles");
        $css = file_get_contents(TESTS_DIR . 'src/media.css');
        $mod = rcube_utils::mod_css_styles($css, 'rcmbody');
        $this->assertContains('#rcmbody table[class=w600]', $mod, 'Replace styles nested in @media block');
        $this->assertContains('#rcmbody {width:600px', $mod, 'Replace body selector nested in @media block');
    }
    /**
@@ -262,4 +268,44 @@
            $this->assertSame($v[2], $result);
        }
    }
    /**
     * rcube:utils::strtotime()
     */
    function test_strtotime()
    {
        $test = array(
            '1' => 1,
            '' => 0,
            '2013-04-22' => 1366581600,
            '2013/04/22' => 1366581600,
            '2013.04.22' => 1366581600,
            '22-04-2013' => 1366581600,
            '22/04/2013' => 1366581600,
            '22.04.2013' => 1366581600,
            '22.4.2013'  => 1366581600,
            '20130422'   => 1366581600,
        );
        foreach ($test as $datetime => $ts) {
            $result = rcube_utils::strtotime($datetime);
            $this->assertSame($ts, $result, "Error parsing date: $datetime");
        }
    }
    /**
     * rcube:utils::normalize _string()
     */
    function test_normalize_string()
    {
        $test = array(
            '' => '',
            'abc def' => 'abc def',
        );
        foreach ($test as $input => $output) {
            $result = rcube_utils::normalize_string($input);
            $this->assertSame($output, $result);
        }
    }
}