<commit_before><?php

namespace OpenOrchestra\GroupBundle\Tests\Functional\Repository;

use OpenOrchestra\BaseBundle\Tests\AbstractTest\AbstractKernelTestCase;
use OpenOrchestra\Pagination\Configuration\FinderConfiguration;
use OpenOrchestra\Pagination\Configuration\PaginateFinderConfiguration;
use OpenOrchestra\UserBundle\Repository\GroupRepository;

/**
 * Class GroupRepositoryTest
 *
 * @group integrationTest
 */
class GroupRepositoryTest extends AbstractKernelTestCase
{
    /**
     * @var GroupRepository
     */
    protected $repository;

    /**
     * Set up test
     */
    protected function setUp()
    {
        parent::setUp();

        static::bootKernel();
        $this->repository = static::$kernel->getContainer()->get('open_orchestra_user.repository.group');
    }

    /**
     * @param array  $descriptionEntity
     * @param array  $search
     * @param array  $order
     * @param int    $skip
     * @param int    $limit
     * @param int    $count
     *
     * @dataProvider providePaginateAndSearch
     */
    public function testFindForPaginate($descriptionEntity, $search, $order, $skip, $limit, $count)
    {
        $configuration = PaginateFinderConfiguration::generateFromVariable($descriptionEntity, $search);
        $configuration->setPaginateConfiguration($order, $skip, $limit);
        $groups = $this->repository->findForPaginate($configuration);
        $this->assertCount($count, $groups);
    }

    /**
     * @return array
     */
    public function providePaginateAndSearch()
    {
        $descriptionEntity = $this->getDescriptionColumnEntity();

        return array(
            array($descriptionEntity, null, null, 0 ,5 , 4),
            array($descriptionEntity, $this->generateSearchProvider('group'), null, 0 ,5 , 4),
            array($descriptionEntity, $this->generateSearchProvider('', 'group'), null, 0 ,5 , 4),
            array($descriptionEntity, $this->generateSearchProvider('', 'fakeGroup'), null, 0 ,5 , 0),
            array($descriptionEntity, $this->generateSearchProvider('Demo'), null, 0 ,5 , 1),
        );
    }

    /**
     * test count all user
     */
    public function testCount()
    {
        $groups = $this->repository->count();
        $this->assertEquals(4, $groups);
    }

    /**
     * find all group with site
     *
     * @return array
     */
    public function testFindAllWithSite()
    {
        $groups = $this->repository->findAllWithSite();
        $this->assertCount(4, $groups);
    }

    /**
     * @param array  $descriptionEntity
     * @param array  $search
     * @param int    $count
     *
     * @dataProvider provideColumnsAndSearchAndCount
     */
    public function testCountWithFilter($descriptionEntity, $search, $count)
    {
        $configuration = FinderConfiguration::generateFromVariable($descriptionEntity, $search);
        $groups = $this->repository->countWithFilter($configuration);
        $this->assertEquals($count, $groups);
    }

    /**
     * @return array
     */
    public function provideColumnsAndSearchAndCount(){
        $descriptionEntity = $this->getDescriptionColumnEntity();

        return array(
            array($descriptionEntity, null, 4),
            array($descriptionEntity, $this->generateSearchProvider('group'), 4),
            array($descriptionEntity, $this->generateSearchProvider('Demo'), 1),
            array($descriptionEntity, $this->generateSearchProvider('', 'fakeName'), 0),
        );
    }
<commit_msg>fix functional test<commit_after><?php

namespace OpenOrchestra\GroupBundle\Tests\Functional\Repository;

use OpenOrchestra\BaseBundle\Tests\AbstractTest\AbstractKernelTestCase;
use OpenOrchestra\Pagination\Configuration\FinderConfiguration;
use OpenOrchestra\Pagination\Configuration\PaginateFinderConfiguration;
use OpenOrchestra\UserBundle\Repository\GroupRepository;

/**
 * Class GroupRepositoryTest
 *
 * @group integrationTest
 */
class GroupRepositoryTest extends AbstractKernelTestCase
{
    /**
     * @var GroupRepository
     */
    protected $repository;

    /**
     * Set up test
     */
    protected function setUp()
    {
        parent::setUp();

        static::bootKernel();
        $this->repository = static::$kernel->getContainer()->get('open_orchestra_user.repository.group');
    }

    /**
     * @param array  $descriptionEntity
     * @param array  $search
     * @param array  $order
     * @param int    $skip
     * @param int    $limit
     * @param int    $count
     *
     * @dataProvider providePaginateAndSearch
     */
    public function testFindForPaginate($descriptionEntity, $search, $order, $skip, $limit, $count)
    {
        $configuration = PaginateFinderConfiguration::generateFromVariable($descriptionEntity, $search);
        $configuration->setPaginateConfiguration($order, $skip, $limit);
        $groups = $this->repository->findForPaginate($configuration);
        $this->assertCount($count, $groups);
    }

    /**
     * @return array
     */
    public function providePaginateAndSearch()
    {
        $descriptionEntity = $this->getDescriptionColumnEntity();

        return array(
            array($descriptionEntity, null, null, 0 ,5 , 5),
            array($descriptionEntity, $this->generateSearchProvider('group'), null, 0 ,5 , 5),
            array($descriptionEntity, $this->generateSearchProvider('', 'group'), null, 0 ,5 , 5),
            array($descriptionEntity, $this->generateSearchProvider('', 'fakeGroup'), null, 0 ,5 , 0),
            array($descriptionEntity, $this->generateSearchProvider('Demo'), null, 0 ,5 , 1),
        );
    }

    /**
     * test count all user
     */
    public function testCount()
    {
        $groups = $this->repository->count();
        $this->assertEquals(5, $groups);
    }

    /**
     * find all group with site
     *
     * @return array
     */
    public function testFindAllWithSite()
    {
        $groups = $this->repository->findAllWithSite();
        $this->assertCount(5, $groups);
    }

    /**
     * @param array  $descriptionEntity
     * @param array  $search
     * @param int    $count
     *
     * @dataProvider provideColumnsAndSearchAndCount
     */
    public function testCountWithFilter($descriptionEntity, $search, $count)
    {
        $configuration = FinderConfiguration::generateFromVariable($descriptionEntity, $search);
        $groups = $this->repository->countWithFilter($configuration);
        $this->assertEquals($count, $groups);
    }

    /**
     * @return array
     */
    public function provideColumnsAndSearchAndCount(){
        $descriptionEntity = $this->getDescriptionColumnEntity();

        return array(
            array($descriptionEntity, null, 5),
            array($descriptionEntity, $this->generateSearchProvider('group'), 5),
            array($descriptionEntity, $this->generateSearchProvider('Demo'), 1),
            array($descriptionEntity, $this->generateSearchProvider('', 'fakeName'), 0),
        );
    }

{'fraction_non_alphanumeric': 0.13019787783194722, 'fraction_numerical': 0.006022368798394035, 'mean_word_length': 2.9608177172061327, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 53, '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': '6271246', 'n_tokens_mistral': 1863, 'n_tokens_neox': 1840, 'n_words': 366}