<commit_before><?php

namespace Amiss\Test\Unit\Active;

use Amiss\Active\Record;

class RecordEventTest extends \CustomTestCase
{
	public function setUp()
	{
		$this->manager = $this->getMock(
			'Amiss\Manager',
			array('insert', 'update', 'delete', 'save'),
			array(),
			'',
			!'callOriginalConstructor'
		);
		
		RecordEventTestRecord::setManager($this->manager);
	}

	/**
	 * @covers Amiss\Active\Record::beforeUpdate
	 */
	public function testBeforeUpdate()
	{
		$ret = $this->getMock(__NAMESPACE__.'\RecordEventTestRecord', array('beforeUpdate'));
		$ret->expects($this->once())->method('beforeUpdate');
		$this->manager->expects($this->once())->method('update');
		$ret->update();
	}

	/**
	 * @covers Amiss\Active\Record::beforeInsert
	 */
	public function testBeforeInsert()
	{
		$ret = $this->getMock(__NAMESPACE__.'\RecordEventTestRecord', array('beforeInsert'));
		$ret->expects($this->once())->method('beforeInsert');
		$this->manager->expects($this->once())->method('insert');
		$ret->insert();
	}
	
	/**
	 * @covers Amiss\Active\Record::delete
	 */
	public function testBeforeDelete()
	{
		$ret = $this->getMock(__NAMESPACE__.'\RecordEventTestRecord', array('beforeDelete'));
		$ret->expects($this->once())->method('beforeDelete');
		$this->manager->expects($this->once())->method('delete');
		$ret->delete();
	}
	
	/**
	 * @covers Amiss\Active\Record::beforeSave
	 */
	public function testBeforeSaveCalledOnInsert()
	{
		$ret = $this->getMock(__NAMESPACE__.'\RecordEventTestRecord', array('beforeSave'));
		$ret->expects($this->once())->method('beforeSave');
		$this->manager->expects($this->once())->method('insert');
		$ret->insert();
	}
	
	/**
	 * @covers Amiss\Active\Record::beforeSave
	 */
	public function testBeforeUpdateCalledOnUpdate()
	{
		$ret = $this->getMock(__NAMESPACE__.'\RecordEventTestRecord', array('beforeSave'));
		$ret->expects($this->once())->method('beforeSave');
		$this->manager->expects($this->once())->method('update');
		$ret->update();
	}
}

class RecordEventTestRecord extends Record
{
	
}
<commit_msg>fixed bullshit phpunit<commit_after><?php

namespace Amiss\Test\Unit\Active;

use Amiss\Active\Record;

class RecordEventTest extends \CustomTestCase
{
	public function setUp()
	{
		$this->manager = $this->getMock(
			'Amiss\Manager',
			array('insert', 'update', 'delete', 'save'),
			array(),
			'',
			!'callOriginalConstructor'
		);
		
		RecordEventTestRecord::setManager($this->manager);
	}

	/**
	 * @covers Amiss\Active\Record::beforeUpdate
	 */
	public function testBeforeUpdate()
	{
		$ret = $this->getMock(__NAMESPACE__.'\RecordEventTestRecord', array('beforeUpdate'));
		$ret->expects($this->once())->method('beforeUpdate');
		$this->manager->expects($this->once())->method('update');
		$ret->update();
	}

	/**
	 * @covers Amiss\Active\Record::beforeInsert
	 */
	public function testBeforeInsert()
	{
		$ret = $this->getMock(__NAMESPACE__.'\RecordEventTestRecord', array('beforeInsert'));
		$ret->expects($this->once())->method('beforeInsert');
		$this->manager->expects($this->once())->method('insert');
		$ret->insert();
	}
	
	/**
	 * @covers Amiss\Active\Record::delete
	 */
	public function testBeforeDelete()
	{
		$ret = $this->getMock(__NAMESPACE__.'\RecordEventTestRecord', array('beforeDelete'));
		$ret->expects($this->once())->method('beforeDelete');
		$this->manager->expects($this->once())->method('delete');
		$ret->delete();
	}
	
	/**
	 * @covers Amiss\Active\Record::beforeSave
	 */
	public function testBeforeSaveCalledOnInsert()
	{
		$ret = $this->getMock(__NAMESPACE__.'\RecordEventTestRecord', array('beforeSave'), array(), 'PHPUnitGotcha_BeforeSaveCalledOnInsert');
		$ret->expects($this->once())->method('beforeSave');
		$this->manager->expects($this->once())->method('insert');
		$ret->insert();
	}
	
	/**
	 * @covers Amiss\Active\Record::beforeSave
	 */
	public function testBeforeSaveCalledOnUpdate()
	{
		$ret = $this->getMock(__NAMESPACE__.'\RecordEventTestRecord', array('beforeSave'), array(), 'PHPUnitGotcha_BeforeSaveCalledOnUpdate');
		$ret->expects($this->once())->method('beforeSave');
		$this->manager->expects($this->once())->method('update');
		$ret->update();
	}
}

class RecordEventTestRecord extends Record
{
	
}

{'fraction_non_alphanumeric': 0.209528324247452, 'fraction_numerical': 0.0, 'mean_word_length': 5.403641881638847, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 99, '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': '4722774', 'n_tokens_mistral': 1467, 'n_tokens_neox': 1371, 'n_words': 168}