<commit_before><?php
namespace Doctrine\Tests\Common\Collections;

use Doctrine\Common\Collections\Criteria;
use Doctrine\Common\Collections\Expr\Comparison;

class CriteriaTest extends \PHPUnit_Framework_TestCase
{
    public function testConstructor()
    {
        $expr     = new Comparison("field", "=", "value");
        $criteria = new Criteria($expr, array("foo" => "ASC"), 10, 20);

        $this->assertSame($expr, $criteria->getWhereExpression());
        $this->assertEquals(array("foo" => "ASC"), $criteria->getOrderings());
        $this->assertEquals(10, $criteria->getFirstResult());
        $this->assertEquals(20, $criteria->getMaxResults());
    }

    public function testWhere()
    {
        $expr     = new Comparison("field", "=", "value");
        $criteria = new Criteria();

        $criteria->where($expr);

        $this->assertSame($expr, $criteria->getWhereExpression());
    }

    public function testOrderings()
    {
        $criteria = new Criteria();

        $criteria->orderBy(array("foo" => "ASC"));

        $this->assertEquals(array("foo" => "ASC"), $criteria->getOrderings());
    }
}<commit_msg>Add Criteria::create()<commit_after><?php
namespace Doctrine\Tests\Common\Collections;

use Doctrine\Common\Collections\Criteria;
use Doctrine\Common\Collections\Expr\Comparison;

class CriteriaTest extends \PHPUnit_Framework_TestCase
{
    public function testCreate()
    {
        $criteria = Criteria::create();

        $this->assertInstanceOf("Doctrine\Common\Collections\Criteria", $criteria);
    }

    public function testConstructor()
    {
        $expr     = new Comparison("field", "=", "value");
        $criteria = new Criteria($expr, array("foo" => "ASC"), 10, 20);

        $this->assertSame($expr, $criteria->getWhereExpression());
        $this->assertEquals(array("foo" => "ASC"), $criteria->getOrderings());
        $this->assertEquals(10, $criteria->getFirstResult());
        $this->assertEquals(20, $criteria->getMaxResults());
    }

    public function testWhere()
    {
        $expr     = new Comparison("field", "=", "value");
        $criteria = new Criteria();

        $criteria->where($expr);

        $this->assertSame($expr, $criteria->getWhereExpression());
    }

    public function testOrderings()
    {
        $criteria = Criteria::create()
            ->orderBy(array("foo" => "ASC"));

        $this->assertEquals(array("foo" => "ASC"), $criteria->getOrderings());
    }
}
{'fraction_non_alphanumeric': 0.1735234215885947, 'fraction_numerical': 0.006517311608961304, 'mean_word_length': 3.354609929078014, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 40, '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': '4463578', 'n_tokens_mistral': 719, 'n_tokens_neox': 688, 'n_words': 123}