<commit_before><?php

/**
 * @covers ApiThank
 *
 * @group Thanks
 * @group Database
 * @group medium
 * @group API
 *
 * @author <NAME>
 */
class ApiThankTest extends \ApiTestCase {

	public function setUp() {
		parent::setUp();
		$this->doLogin( 'sysop' );
	}

	public function testRequestWithoutToken(){
		$this->setExpectedException( 'UsageException', 'The token parameter must be set' );
		$this->doApiRequest( array(
			'action' => 'thank',
			'source' => 'someSource',
			'rev' => 1,
		) );
	}

	public function testValidRequest(){
		list( $result,, ) = $this->doApiRequestWithToken( array(
			'action' => 'thank',
			'rev' => $this->newRevId(),
		) );
		$this->assertSuccess( $result );
	}

	public function testValidRequestWithSource(){
		list( $result,, ) = $this->doApiRequestWithToken( array(
			'action' => 'thank',
			'source' => 'someSource',
			'rev' => $this->newRevId(),<commit_msg>Thanks is not using namespaces<commit_after><?php

/**
 * @covers ApiThank
 *
 * @group Thanks
 * @group Database
 * @group medium
 * @group API
 *
 * @author <NAME>
 */
class ApiThankTest extends ApiTestCase {

	public function setUp() {
		parent::setUp();
		$this->doLogin( 'sysop' );
	}

	public function testRequestWithoutToken(){
		$this->setExpectedException( 'UsageException', 'The token parameter must be set' );
		$this->doApiRequest( array(
			'action' => 'thank',
			'source' => 'someSource',
			'rev' => 1,
		) );
	}

	public function testValidRequest(){
		list( $result,, ) = $this->doApiRequestWithToken( array(
			'action' => 'thank',
			'rev' => $this->newRevId(),
		) );
		$this->assertSuccess( $result );
	}

	public function testValidRequestWithSource(){
		list( $result,, ) = $this->doApiRequestWithToken( array(
			'action' => 'thank',
			'source' => 'someSource',
			'rev' => $this->newRevId(),
{'fraction_non_alphanumeric': 0.18337004405286345, 'fraction_numerical': 0.0011013215859030838, 'mean_word_length': 4.132768361581921, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 37, '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': '4974673', 'n_tokens_mistral': 669, 'n_tokens_neox': 609, 'n_words': 139}