@@ -472,26 +472,63 @@ function testTrailingWhitespace() {
472472 }
473473
474474 /**
475- * @expectedException Sabberworm\CSS\Parsing\UnexpectedTokenException
476- */
475+ * @expectedException \ Sabberworm\CSS\Parsing\UnexpectedTokenException
476+ */
477477 function testCharsetFailure1 () {
478478 $ this ->parsedStructureForFile ('-charset-after-rule ' , Settings::create ()->withLenientParsing (false ));
479479 }
480480
481481 /**
482- * @expectedException Sabberworm\CSS\Parsing\UnexpectedTokenException
483- */
482+ * @expectedException \ Sabberworm\CSS\Parsing\UnexpectedTokenException
483+ */
484484 function testCharsetFailure2 () {
485485 $ this ->parsedStructureForFile ('-charset-in-block ' , Settings::create ()->withLenientParsing (false ));
486486 }
487487
488488 /**
489- * @expectedException Sabberworm\CSS\Parsing\SourceException
490- */
489+ * @expectedException \ Sabberworm\CSS\Parsing\SourceException
490+ */
491491 function testUnopenedClosingBracketFailure () {
492492 $ this ->parsedStructureForFile ('unopened-close-brackets ' , Settings::create ()->withLenientParsing (false ));
493493 }
494494
495+ /**
496+ * Ensure that a missing property value raises an exception.
497+ *
498+ * @expectedException \Sabberworm\CSS\Parsing\UnexpectedTokenException
499+ * @covers \Sabberworm\CSS\Value\Value::parseValue()
500+ */
501+ function testMissingPropertyValueStrict () {
502+ $ this ->parsedStructureForFile ('missing-property-value ' , Settings::create ()->withLenientParsing (false ));
503+ }
504+
505+ /**
506+ * Ensure that a missing property value is ignored when in lenient parsing mode.
507+ *
508+ * @covers \Sabberworm\CSS\Value\Value::parseValue()
509+ */
510+ function testMissingPropertyValueLenient () {
511+ $ parsed = $ this ->parsedStructureForFile ('missing-property-value ' , Settings::create ()->withLenientParsing (true ));
512+ $ rulesets = $ parsed ->getAllRuleSets ();
513+ $ this ->assertCount ( 1 , $ rulesets );
514+ $ block = $ rulesets [0 ];
515+ $ this ->assertTrue ( $ block instanceof DeclarationBlock );
516+ $ this ->assertEquals ( array ( 'div ' ), $ block ->getSelectors () );
517+ $ rules = $ block ->getRules ();
518+ $ this ->assertCount ( 1 , $ rules );
519+ $ rule = $ rules [0 ];
520+ $ this ->assertEquals ( 'display ' , $ rule ->getRule () );
521+ $ this ->assertEquals ( 'inline-block ' , $ rule ->getValue () );
522+ }
523+
524+ /**
525+ * Parse structure for file.
526+ *
527+ * @param string $sFileName Filename.
528+ * @param null|obJeCt $oSettings Settings.
529+ *
530+ * @return CSSList\Document Parsed document.
531+ */
495532 function parsedStructureForFile ($ sFileName , $ oSettings = null ) {
496533 $ sFile = dirname (__FILE__ ) . '/../../files ' . DIRECTORY_SEPARATOR . "$ sFileName.css " ;
497534 $ oParser = new Parser (file_get_contents ($ sFile ), $ oSettings );
0 commit comments