<commit_before><?php

class Ergo_Http_RequestTest extends UnitTestCase
{
	public function testSimpleUsage()
	{
		$headers = array(
			new Ergo_Http_HeaderField('Content-Length', 9)
		);

		$request = new Ergo_Http_Request(
			Ergo_Http_Request::METHOD_GET,
			new Ergo_Http_Url('http://example.org/test/123?a=b'),
			$headers,
			'test data'
		);

		$this->assertEqual($request->getRequestMethod(), 'GET');
		$this->assertEqual($request->getUrl()->getPath(), '/test/123');
		$this->assertEqual($request->getBody(), 'test data');
		$this->assertEqual($request->getHeaders()->toArray(false), array(
			'Content-Length: 9'
			));
	}

	public function testRequestFactoryWithAbsoluteUrlInEnvironment()
	{
		$_SERVER['HTTP_HOST'] = 'example.com'; // .com
		$_SERVER['SERVER_PORT'] = '80';
		$_SERVER['REQUEST_URI'] = 'http://example.org/'; // .org

		$factory = new Ergo_Http_RequestFactory();
		$request = $factory->create();

		// I'm not sure exactly what the URL should be, but
		// there's currently a bug which is definitely less correct
		// than a URL that matches this pattern...
		$this->assertPattern(
			'#https?://example.com(:80)?/#',
			$request->getUrl()->__toString(),
			'url: %s'
		);
	}
}
<commit_msg>Fixed warning in RequestTest<commit_after><?php

class Ergo_Http_RequestTest extends UnitTestCase
{
	public function testSimpleUsage()
	{
		$headers = array(
			new Ergo_Http_HeaderField('Content-Length', 9)
		);

		$request = new Ergo_Http_Request(
			Ergo_Http_Request::METHOD_GET,
			new Ergo_Http_Url('http://example.org/test/123?a=b'),
			$headers,
			'test data'
		);

		$this->assertEqual($request->getRequestMethod(), 'GET');
		$this->assertEqual($request->getUrl()->getPath(), '/test/123');
		$this->assertEqual($request->getBody(), 'test data');
		$this->assertEqual($request->getHeaders()->toArray(false), array(
			'Content-Length: 9'
			));
	}

	public function testRequestFactoryWithAbsoluteUrlInEnvironment()
	{
		$_SERVER['HTTP_HOST'] = 'example.com'; // .com
		$_SERVER['SERVER_PORT'] = '80';
		$_SERVER['REQUEST_URI'] = 'http://example.org/'; // .org
		$_SERVER['REQUEST_METHOD'] = 'GET';

		$factory = new Ergo_Http_RequestFactory();
		$request = $factory->create();

		// I'm not sure exactly what the URL should be, but
		// there's currently a bug which is definitely less correct
		// than a URL that matches this pattern...
		$this->assertPattern(
			'#https?://example.com(:80)?/#',
			$request->getUrl()->__toString(),
			'url: %s'
		);
	}
}

{'fraction_non_alphanumeric': 0.18082964156262585, 'fraction_numerical': 0.009665726943213854, 'mean_word_length': 4.365010799136069, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 31, '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': '6244540', 'n_tokens_mistral': 913, 'n_tokens_neox': 807, 'n_words': 165}