<commit_before><?php

require_once 'lib/autoload.php';

class Controller_MethodTest extends PHPUnit_Framework_TestCase {
	
	public function requests() {
		return array(
			array('/foo/', 'getFoo foo|'),
			array('/foo/other/crap/here', 'getFoo foo|other|crap|here'),
			array('/FOO/bar/', 'getFooBar FOO|bar|'),
			array('/FOO/bar.html', 'getFooBar FOO|bar.html'),
			array('/foo.json', 'getFooJson foo.json'),
			array('/', 'get '),
			array('', 'get '),
			array('foo/bar/2112', 'getFooBar foo|bar|2112'),
		);
	}
	
	/**
	 * @dataProvider requests
	 */
	public function test($request_uri, $expected) {
		$_SERVER['REQUEST_URI'] = $request_uri;
		
		$controller = new TestController();
		
		ob_start();
		$controller->control();
		$result = ob_get_contents();
		ob_end_clean();
		
		$this->assertEquals($expected, $result);
	}
}

class TestController extends Controller_PathMethod {
	
	const PREFIX = 'get';
	
	public function __construct() {
		
	}
	
	protected function get(array $parts) {
		echo __FUNCTION__.' '.implode('|', $parts);
	}
	
	protected function getFoo(array $parts) {
		echo __FUNCTION__.' '.implode('|', $parts);
	}
	
	protected function getFooJson(array $parts) {
		echo __FUNCTION__.' '.implode('|', $parts);
	}
	
	protected function getFooBar(array $parts) {
		echo __FUNCTION__.' '.implode('|', $parts);
	}
}
<commit_msg>added _ path separator to methods<commit_after><?php

require_once 'lib/autoload.php';

class Controller_PathMethodTest extends PHPUnit_Framework_TestCase {
	
	public function requests() {
		return array(
			array('/foo/', 'getFoo foo|'),
			array('/foo/other/crap/here', 'getFoo foo|other|crap|here'),
			array('/FOO/bar/', 'getFoo_Bar FOO|bar|'),
			array('/FOO/bar.html', 'getFoo_Bar FOO|bar.html'),
			array('/foo.json', 'getFoo_Json foo.json'),
			array('/', 'get '),
			array('', 'get '),
			array('foo/bar/2112', 'getFoo_Bar foo|bar|2112'),
		);
	}
	
	/**
	 * @dataProvider requests
	 */
	public function test($request_uri, $expected) {
		$_SERVER['REQUEST_URI'] = $request_uri;
		
		$controller = new TestController();
		
		ob_start();
		$controller->control();
		$result = ob_get_contents();
		ob_end_clean();
		
		$this->assertEquals($expected, $result);
	}
}

class TestController extends Controller_PathMethod {
	
	const PREFIX = 'get';
	
	public function __construct() {
		
	}
	
	protected function get(array $parts) {
		echo __FUNCTION__.' '.implode('|', $parts);
	}
	
	protected function getFoo(array $parts) {
		echo __FUNCTION__.' '.implode('|', $parts);
	}
	
	protected function getFoo_Json(array $parts) {
		echo __FUNCTION__.' '.implode('|', $parts);
	}
	
	protected function getFoo_Bar(array $parts) {
		echo __FUNCTION__.' '.implode('|', $parts);
	}
}

{'fraction_non_alphanumeric': 0.1780721118469463, 'fraction_numerical': 0.005886681383370125, 'mean_word_length': 4.249034749034749, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6627298', 'n_tokens_mistral': 1058, 'n_tokens_neox': 912, 'n_words': 192}