Test invalid media queries.
public function testInvalidMediaQueries() {
$media_queries = array(
'',
'not (orientation)',
'only (orientation)',
'all and not all',
'screen and (width: 0xx)',
'screen and (width: -8xx)',
'screen and (width: -xx)',
'screen and (width: xx)',
'screen and (width: px)',
'screen and (width: -8px)',
'screen and (width: -0.8px)',
'screen and (height: 0xx)',
'screen and (height: -8xx)',
'screen and (height: -xx)',
'screen and (height: xx)',
'screen and (height: px)',
'screen and (height: -8px)',
'screen and (height: -0.8px)',
'screen and (device-width: 0xx)',
'screen and (device-width: -8xx)',
'screen and (device-width: -xx)',
'screen and (device-width: xx)',
'screen and (device-width: px)',
'screen and (device-width: -8px)',
'screen and (device-width: -0.8px)',
'screen and (device-height: 0xx)',
'screen and (device-height: -8xx)',
'screen and (device-height: -xx)',
'screen and (device-height: xx)',
'screen and (device-height: px)',
'screen and (device-height: -8px)',
'screen and (device-height: -0.8px)',
'screen and (min-orientation)',
'screen and (max-orientation)',
'screen and (orientation: bogus)',
'(orientation: bogus)',
'screen and (ori"entation: bogus)',
);
foreach ($media_queries as $media_query) {
try {
$this
->assertFalse(Breakpoint::isValidMediaQuery($media_query), $media_query . ' is not valid.');
} catch (InvalidBreakpointMediaQueryException $e) {
$this
->assertTrue(TRUE, format_string('%media_query is not valid.', array(
'%media_query' => $media_query,
)));
}
}
}