PHPUnit: Calling methods inside dataprovider

Is there anyway I can call a method within the dataprovider method? I tried doing it but the value passed from the dataProvider to the testAdd() method won’t just pass. How do I do this?

PS: I do not want to call this from setUp() or setUpBeforeClass(), any way out?

class DataTest extends PHPUnit_Framework_TestCase
     * @dataProvider additionProvider
    public function testAdd($a, $b, $expected, $someValue)
        echo $someValue;
        $this->assertEquals($expected, $a + $b);

    public function additionProvider()
        $someValue = $this->doSomething();

        return array(
          array(0, 0, 0, $someValue),
          array(0, 1, 1, $someValue),
          array(1, 0, 1, $someValue),
          array(1, 1, 3, $someValue)

    protected function doSomething(){

      return 5 * 6;



This works fine for me. What output are you getting when you run the test?