<?php

class OperatorTest extends PHPUnit_Framework_TestCase
{
    public function testShortenedTernary()
    {
        if (version_compare(PHP_VERSION, '5.3', '<')) {
            $this->markTestSkipped('shortened ternary operator not available');
            return;
        }
        $this->assertEquals(42, null ?: 42);
        $this->assertEquals(42, false ?: 42);
        $this->assertEquals(true, true ?: 42);
    }
}

<?php

class OperatorTest extends PHPUnit_Framework_TestCase
{
    public function testShortenedTernary()
    {
        if (version_compare(PHP_VERSION, '5.3', '<')) {
            $this->markTestSkipped('shortened ternary operator not available');
            return;
        }
        $this->assertEquals(42, eval('return null ?: 42;'));
        $this->assertEquals(42, eval('return false ?: 42;'));
        $this->assertEquals(null, eval('true ?: 42;'), "Weird eval behavior, really expect true.");
    }
}

Use eval for shortened ternary operator.
Use eval for shortened ternary operator.
