<commit_before><?php

namespace Adldap\Tests\Query;

use Adldap\Query\Builder;
use Adldap\Tests\UnitTestCase;

class BuilderTest extends UnitTestCase
{
    public function testConstruct()
    {
        $b = new Builder();

        $this->assertEmpty($b->getQuery());
    }

    public function testGetSelectsAreEmpty()
    {
        $b = new Builder();

        $this->assertEquals([], $b->getSelects());
    }

    public function testSelectArray()
    {
        $b = new Builder();

        $b->select(['testing']);

        $selects = [
            'testing',
            'objectclass',
        ];

        $this->assertEquals($selects,  $b->getSelects());
    }

    public function testSelectString()
    {
        $b = new Builder();

        $b->select('testing');

        $selects = [
            'testing',
            'objectclass',
        ];

        $this->assertEquals($selects,  $b->getSelects());
    }

    public function testSelectEmptyString()
    {
        $b = new Builder();

        $b->select('');

        $this->assertEquals([],  $b->getSelects());
    }
}<commit_msg>Added more query builder tests<commit_after><?php

namespace Adldap\Tests\Query;

use Adldap\Query\Builder;
use Adldap\Tests\UnitTestCase;

class BuilderTest extends UnitTestCase
{
    public function testConstruct()
    {
        $b = new Builder();

        $this->assertEmpty($b->getQuery());
    }

    public function testGetSelectsAreEmpty()
    {
        $b = new Builder();

        $this->assertEquals([], $b->getSelects());
    }

    public function testSelectArray()
    {
        $b = new Builder();

        $b->select(['testing']);

        $selects = [
            'testing',
            'objectclass',
        ];

        $this->assertEquals($selects,  $b->getSelects());
    }

    public function testSelectString()
    {
        $b = new Builder();

        $b->select('testing');

        $selects = [
            'testing',
            'objectclass',
        ];

        $this->assertEquals($selects,  $b->getSelects());
    }

    public function testSelectEmptyString()
    {
        $b = new Builder();

        $b->select('');

        $this->assertEquals([],  $b->getSelects());
    }

    public function testWhere()
    {
        $b = new Builder();

        $b->where('cn', '=', 'test');

        $wheres = [
            [
                'field' => 'cn',
                'operator' => '=',
                'value' => '\74\65\73\74',
            ]
        ];

        $this->assertEquals($wheres, $b->getWheres());
    }

    public function testWhereContains()
    {
        $b = new Builder();

        $b->whereContains('cn', 'test');

        $wheres = [
            [
                'field' => 'cn',
                'operator' => 'contains',
                'value' => '\74\65\73\74',
            ]
        ];

        $this->assertEquals($wheres, $b->getWheres());
    }

    public function testWhereStartsWith()
    {
        $b = new Builder();

        $b->whereStartsWith('cn', 'test');

        $wheres = [
            [
                'field' => 'cn',
                'operator' => 'starts_with',
                'value' => '\74\65\73\74',
            ]
        ];

        $this->assertEquals($wheres, $b->getWheres());
    }

    public function testWhereEndsWith()
    {
        $b = new Builder();

        $b->whereEndsWith('cn', 'test');

        $wheres = [
            [
                'field' => 'cn',
                'operator' => 'ends_with',
                'value' => '\74\65\73\74',
            ]
        ];

        $this->assertEquals($wheres, $b->getWheres());
    }

    public function testOrWhere()
    {
        $b = new Builder();

        $b->orWhere('cn', '=', 'test');

        $wheres = [
            [
                'field' => 'cn',
                'operator' => '=',
                'value' => '\74\65\73\74',
            ]
        ];

        $this->assertEquals($wheres, $b->getOrWheres());
    }

    public function testOrWhereContains()
    {
        $b = new Builder();

        $b->orWhereContains('cn', 'test');

        $wheres = [
            [
                'field' => 'cn',
                'operator' => 'contains',
                'value' => '\74\65\73\74',
            ]
        ];

        $this->assertEquals($wheres, $b->getOrWheres());
    }

    public function testOrWhereStartsWith()
    {
        $b = new Builder();

        $b->orWhereStartsWith('cn', 'test');

        $wheres = [
            [
                'field' => 'cn',
                'operator' => 'starts_with',
                'value' => '\74\65\73\74',
            ]
        ];

        $this->assertEquals($wheres, $b->getOrWheres());
    }

    public function testOrWhereEndsWith()
    {
        $b = new Builder();

        $b->orWhereEndsWith('cn', 'test');

        $wheres = [
            [
                'field' => 'cn',
                'operator' => 'ends_with',
                'value' => '\74\65\73\74',
            ]
        ];

        $this->assertEquals($wheres, $b->getOrWheres());
    }
}
{'fraction_non_alphanumeric': 0.1732097060564214, 'fraction_numerical': 0.012625764450581969, 'mean_word_length': 1.4865129965669446, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 77, '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': '6483342', 'n_tokens_mistral': 1615, 'n_tokens_neox': 1483, 'n_words': 256}