<commit_before><?php
/**
 * @group Controllers
 *
 * @todo Lots of assumptions: the presence of a user model, local db auth storage.
 * Garp routes must be used (or at least a route called 'auth_submit').
 *
 */
class G_AuthControllerTest extends Garp_Test_PHPUnit_ControllerTestCase {
	protected $_mockUser = array(
		'first_name' => 'Harmen',
		'email' => '<EMAIL>',
		'password' => '<PASSWORD>',
		'role' => 'user'
	);

	protected $_auth;

	public function testProcessShouldLoginUser() {
		$url = Zend_Controller_Front::getInstance()->getRouter()->assemble(array(
		), 'auth_submit');

		$this->request->setMethod('POST')
			->setPost(array(
				'email' => $this->_mockUser['email'],
				'password' => $this->_mockUser['password']
			));
		$this->dispatch($url);

		$this->assertEquals(true, $this->_auth->isLoggedIn());
	}

	public function setUp() {
		parent::setUp();
		$this->_auth = Garp_Auth::getInstance();
		$this->_auth->setStore(new Garp_Store_Array('Garp_Auth'));
		$this->_auth->destroy();

		$userModel = new Model_User();
		$userModel->delete('id > 0');
		$userModel->insert($this->_mockUser);
	}

	public function tearDown() {
		$this->_auth->destroy();
		$userModel = new Model_User();
		$userModel->delete('id > 0');
	}

}
<commit_msg>Refactored Login test to use "name" instead of "first_name"<commit_after><?php
/**
 * @group Controllers
 *
 * @todo Lots of assumptions: the presence of a user model, local db auth storage.
 * Garp routes must be used (or at least a route called 'auth_submit').
 *
 */
class G_AuthControllerTest extends Garp_Test_PHPUnit_ControllerTestCase {
	protected $_mockUser = array(
		'first_name' => 'Harmen',
		'email' => '<EMAIL>',
		'password' => '<PASSWORD>',
		'role' => 'user'
	);

	protected $_auth;

	public function testProcessShouldLoginUser() {
		$url = Zend_Controller_Front::getInstance()->getRouter()->assemble(array(
		), 'auth_submit');

		$this->request->setMethod('POST')
			->setPost(array(
				'email' => $this->_mockUser['email'],
				'password' => $this->_mockUser['password']
			));
		$this->dispatch($url);

		$this->assertEquals(true, $this->_auth->isLoggedIn());
	}

	public function setUp() {
		parent::setUp();
		$this->_auth = Garp_Auth::getInstance();
		$this->_auth->setStore(new Garp_Store_Array('Garp_Auth'));
		$this->_auth->destroy();

		$userModel = new Model_User();
		// sanity check
		$sampleRow = $userModel->createRow();
		if (isset($sampleRow->name)) {
			$this->_mockUser['name'] = $this->_mockUser['first_name'];
			unset($this->_mockUser['first_name']);
		}
		
		$userModel->delete('id > 0');
		$userModel->insert($this->_mockUser);
	}

	public function tearDown() {
		$this->_auth->destroy();
		$userModel = new Model_User();
		$userModel->delete('id > 0');
	}

}

{'fraction_non_alphanumeric': 0.1889050036258158, 'fraction_numerical': 0.0014503263234227702, 'mean_word_length': 4.735966735966736, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 72, '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': '1218550', 'n_tokens_mistral': 1001, 'n_tokens_neox': 916, 'n_words': 187}