<?php

class Unit extends PHPUnit_Framework_TestCase {

	public function subject($params = array(), $options = array()) {
		$options += array(
			'mock' => false,
			'methods' => array(),
		);
		$class = 'alfmarks\\' . str_replace('Test', '', get_called_class());
		if ($options['mock']) {
			return $this->getMock($class, $options['methods'], $params);
		}
		return new $class($params);
	}

}
<?php

class Unit extends PHPUnit_Framework_TestCase {

	public function subject($params = array(), $options = array()) {
		$options += array(
			'mock' => false,
			'methods' => array(),
		);
		$class = 'alfmarks\\' . str_replace('Test', '', get_called_class());
		if ($options['mock']) {
			return $this->getMockBuilder($class)
				->setMethods($options['methods'])
				->getMock();
		}
		return new $class($params);
	}

}

Update for the newer version of phpunit.
Update for the newer version of phpunit.
