<commit_before><?php


class DBUrlTest extends Tipsy_Test {

	public function setUp() {
		$this->tip = new Tipsy\Tipsy;
		$this->useOb = true; // for debug use

		$this->tip->config('tests/config.ini');
		$env = getenv('TRAVIS') ? 'travis' : 'local';
		$this->tip->config('tests/config.db.'.$env.'.ini');

		$url = 'mysql://'.$this->tip->config()['db']['user'].($this->tip->config()['db']['pass'] ? ':'.$this->tip->config()['db']['pass'] : '').'@'.$this->tip->config()['db']['host'].'/'.$this->tip->config()['db']['database'].'?persistent=true&something=else';

		// rebuild
		$this->tip = new Tipsy\Tipsy;
		$this->tip->config('tests/config.ini');
		$this->tip->config([db => [url => $url]]);
	}

	public function testDbUrl() {
		$catch = false;
		try {
			$res = $this->tip->db()->query('select now()');
			foreach ($res as $r) {
			}
		} catch (Exception $e) {
			$catch = true;
		}
		$this->assertFalse($catch);
	}

	public function testDbFail() {
		$this->tip = new Tipsy\Tipsy;

		$catch = false;
		try {
			$res = $this->tip->db()->query('select now()');<commit_msg>added test output for debug<commit_after><?php


class DBUrlTest extends Tipsy_Test {

	public function setUp() {
		$this->tip = new Tipsy\Tipsy;
		$this->useOb = true; // for debug use

		$this->tip->config('tests/config.ini');
		$env = getenv('TRAVIS') ? 'travis' : 'local';
		$this->tip->config('tests/config.db.'.$env.'.ini');

		$url = 'mysql://'.$this->tip->config()['db']['user'].($this->tip->config()['db']['pass'] ? ':'.$this->tip->config()['db']['pass'] : '').'@'.$this->tip->config()['db']['host'].'/'.$this->tip->config()['db']['database'].'?persistent=true&something=else';

		// rebuild
		$this->tip = new Tipsy\Tipsy;
		$this->tip->config('tests/config.ini');
		$this->tip->config([db => [url => $url]]);
	}

	public function testDbUrl() {
		$catch = false;
		try {
			$res = $this->tip->db()->query('select now() as d');
			foreach ($res as $r) {
			}
		} catch (Exception $e) {
			echo $e->getMessage();
			$catch = true;
		}
		$this->assertFalse($catch);
	}

	public function testDbFail() {
		$this->tip = new Tipsy\Tipsy;

		$catch = false;
		try {
			$res = $this->tip->db()->query('select now()');
{'fraction_non_alphanumeric': 0.2720219078046554, 'fraction_numerical': 0.0, 'mean_word_length': 3.88195991091314, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 66, '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': '5132020', 'n_tokens_mistral': 885, 'n_tokens_neox': 815, 'n_words': 137}