Skip to content

Instantly share code, notes, and snippets.

@chartjes
Created October 26, 2013 22:02
Show Gist options
  • Save chartjes/7175117 to your computer and use it in GitHub Desktop.
Save chartjes/7175117 to your computer and use it in GitHub Desktop.
return array(
array('foo', 'bar', 'baz'),
array('alpha', 'beta', 'gamma')
);
@texmorgan
Copy link

I think there is either a bug in PHPUnit, or a setting gone awry, as this gets tokenized recursively.

Here's the code I was sampling:

/** preLoaderArrayDataProvider
 *
 * @return array
 */
public function preLoaderArrayDataProvider()
{
    return array("one" =>
        array(
            'http://yahoo.com',
            'http://google.com',
            'http://facebook.com',
            'http://twitter.com'
        ), "two" =>
        array(
            "http://jquery.com",
            "http://jqueryui.com"
        )
    );
}

/** testSetArray
 *
 * @param array $array the array to use for testing
 *
 * @covers         preLoader::setArray
 *
 * @dataProvider   preLoaderArrayDataProvider
 *
 * @return void
 */
public function testSetArray( $array )
{
    $this->expected = true;
    $this->actual = $this->object->setArray($array);
    $this->assertEquals($this->expected, $this->actual);
}

You would expect $array to be the first array, but it is actually 'http://yahoo.com'.

@texmorgan
Copy link

Per your comments, hashing is not allowed.

However, when I try the code below, the same thing happens, which is contrary to what the gist would suggest:

/** preLoaderArrayDataProvider
 *
 * @return array
 */
public function preLoaderArrayDataProvider()
{
    return array(
        array(
            'http://yahoo.com',
            'http://google.com',
            'http://facebook.com',
            'http://twitter.com'
        ),
        array(
            'http://jquery.com',
            'http://jqueryui.com'
        )
    );
}

@chartjes
Copy link
Author

/** preLoaderArrayDataProvider
 *
 * @return array
 */
public function preLoaderArrayDataProvider()
{
    return array(
        array(
            array(
                'http://yahoo.com',
                'http://google.com',
                'http://facebook.com',
                'http://twitter.com'
            )
        ),
        array(
            array(
                'http://jquery.com',
                'http://jqueryui.com'
            )
        )
    );
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment