<commit_before><?php

require_once dirname(__FILE__) . '/../../bootstrap.php';


class Elastica_LogTest extends PHPUnit_Framework_TestCase
{
	public function setUp() {

	}

	public function tearDown() {
	}

	public function testSetLogConfig() {
		$logPath = '/tmp/php.log';
		$client = new Elastica_Client(array('log' => $logPath));
		$this->assertEquals($logPath, $client->getConfig('log'));
	}
	
	public function testEmptyLogConfig() {
		$client = new Elastica_Client();
		$this->assertEmpty($client->getConfig('log'));
	}
	
	public function testDisabledLog() {
		$client = new Elastica_Client();
		$log = new Elastica_Log($client);
		
		$log->log('hello world');
		
		$this->assertEmpty($log->getLastMessage());
	}
	
	public function testGetLastMessage() {
		$client = new Elastica_Client(array('log' => '/tmp/php.log'));
		$log = new Elastica_Log($client);
		$message = 'hello world';
		
		$log->log($message);
	
		$this->assertEquals($message, $log->getLastMessage());
	}
	
	public function testGetLastMessage2() {
		$client = new Elastica_Client(array('log' => true));
		$log = new Elastica_Log($client);
		$message = 'hello world';
	
		$log->log($message);
	
		$this->assertEquals($message, $log->getLastMessage());
	}
}<commit_msg>improved log tests<commit_after><?php

require_once dirname(__FILE__) . '/../../bootstrap.php';


class Elastica_LogTest extends PHPUnit_Framework_TestCase
{
	public function setUp() {

	}

	public function tearDown() {
	}

	public function testSetLogConfigPath() {
		$logPath = '/tmp/php.log';
		$client = new Elastica_Client(array('log' => $logPath));
		$this->assertEquals($logPath, $client->getConfig('log'));
	}
	
	public function testSetLogConfigEnable() {
		$client = new Elastica_Client(array('log' => true));
		$this->assertTrue($client->getConfig('log'));
	}
	
	public function testEmptyLogConfig() {
		$client = new Elastica_Client();
		$this->assertEmpty($client->getConfig('log'));
	}
	
	public function testDisabledLog() {
		$client = new Elastica_Client();
		$log = new Elastica_Log($client);
		
		$log->log('hello world');
		
		$this->assertEmpty($log->getLastMessage());
	}
	
	public function testGetLastMessage() {
		$client = new Elastica_Client(array('log' => '/tmp/php.log'));
		$log = new Elastica_Log($client);
		$message = 'hello world';
		
		$log->log($message);
	
		$this->assertEquals($message, $log->getLastMessage());
	}
	
	public function testGetLastMessage2() {
		$client = new Elastica_Client(array('log' => true));
		$log = new Elastica_Log($client);
		
		// Set log path temp path as otherwise test fails with output
		$errorLog = ini_get('error_log');
		ini_set('error_log', '/tmp/php.log');
		
		$message = 'hello world';
	
		$log->log($message);
		
		ini_set('error_log', $errorLog);
	
		$this->assertEquals($message, $log->getLastMessage());
	}
}
{'fraction_non_alphanumeric': 0.17605384342897626, 'fraction_numerical': 0.0007084661707403471, 'mean_word_length': 4.693548387096774, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 38, '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': '5976307', 'n_tokens_mistral': 1024, 'n_tokens_neox': 920, 'n_words': 179}