<commit_before><?php

use G4\DataMapper\Engine\MySQL\MySQLComparisonFormatter;
use G4\DataMapper\Common\Selection\Operator;
use G4\DataMapper\Common\SingleValue;

class MySQLComparisonFormatterTest extends PHPUnit_Framework_TestCase
{

    private $comparisonFormatter;

    private $operatorMock;


    protected function setUp()
    {
        $this->comparisonFormatter = new MySQLComparisonFormatter();

        $this->operatorMock = $this->getMockBuilder(\G4\DataMapper\Common\Selection\Operator::class)
            ->disableOriginalConstructor()
            ->getMock();
    }

    protected function tearDown()
    {
        $this->comparisonFormatter = null;
        $this->operatorMock        = null;
    }


    public function testEqual()
    {
        $this->operatorMock->expects($this->once())
            ->method('getSymbol')
            ->willReturn(Operator::EQUAL);

        $this->assertEquals('name = \'test\'', $this->comparisonFormatter->format('name', $this->operatorMock, new SingleValue('test')));
    }

    public function testOperatorNotInMap()
    {
        $this->operatorMock->expects($this->once())
            ->method('getSymbol')
            ->willReturn('not_in_map');

        $this->expectException(\Exception::class);
        $this->expectExceptionMessage('Operator not in map');
        $this->comparisonFormatter->format('name', $this->operatorMock, 'test');
    }
}<commit_msg>000 - Added unit test for greater than operator.<commit_after><?php

use G4\DataMapper\Engine\MySQL\MySQLComparisonFormatter;
use G4\DataMapper\Common\Selection\Operator;
use G4\DataMapper\Common\SingleValue;

class MySQLComparisonFormatterTest extends PHPUnit_Framework_TestCase
{

    private $comparisonFormatter;

    private $operatorMock;


    protected function setUp()
    {
        $this->comparisonFormatter = new MySQLComparisonFormatter();

        $this->operatorMock = $this->getMockBuilder(\G4\DataMapper\Common\Selection\Operator::class)
            ->disableOriginalConstructor()
            ->getMock();
    }

    protected function tearDown()
    {
        $this->comparisonFormatter = null;
        $this->operatorMock        = null;
    }


    public function testEqual()
    {
        $this->operatorMock->expects($this->once())
            ->method('getSymbol')
            ->willReturn(Operator::EQUAL);

        $this->assertEquals('name = \'test\'', $this->comparisonFormatter->format('name', $this->operatorMock, new SingleValue('test')));
    }

    public function testGreaterThan()
    {
        $this->operatorMock->expects($this->once())
            ->method('getSymbol')
            ->willReturn(Operator::GRATER_THAN);

        $this->assertEquals('age > 18', $this->comparisonFormatter->format('age', $this->operatorMock, new SingleValue(18)));
    }



    public function testOperatorNotInMap()
    {
        $this->operatorMock->expects($this->once())
            ->method('getSymbol')
            ->willReturn('not_in_map');

        $this->expectException(\Exception::class);
        $this->expectExceptionMessage('Operator not in map');
        $this->comparisonFormatter->format('name', $this->operatorMock, 'test');
    }
}
{'fraction_non_alphanumeric': 0.14272271016311167, 'fraction_numerical': 0.004705144291091593, 'mean_word_length': 3.083226632522407, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 65, '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': '136266', 'n_tokens_mistral': 882, 'n_tokens_neox': 832, 'n_words': 135}