<commit_before><?php

namespace Tests\IliosApiBundle\Endpoints;

use Symfony\Component\HttpFoundation\Response;
use Tests\CoreBundle\DataLoader\ObjectiveData;
use Tests\IliosApiBundle\ReadWriteEndpointTest;

/**
 * Objective API endpoint Test.
 * @group api_5
 */
class ObjectiveTest extends ReadWriteEndpointTest
{
    protected $testName =  'objectives';

    /**
     * @inheritdoc
     */
    protected function getFixtures()
    {
        return [
            'Tests\CoreBundle\Fixture\LoadObjectiveData',
            'Tests\CoreBundle\Fixture\LoadCompetencyData',
            'Tests\CoreBundle\Fixture\LoadCourseData',
            'Tests\CoreBundle\Fixture\LoadProgramYearData',
            'Tests\CoreBundle\Fixture\LoadSessionData',
            'Tests\CoreBundle\Fixture\LoadMeshDescriptorData'
        ];
    }

    /**
     * @inheritDoc
     */
    public function putsToTest()
    {
        return [
            'title' => ['title', $this->getFaker()->text],
            'position' => ['position', $this->getFaker()->randomDigit],
            'competency' => ['competency', 1],
            'courses' => ['courses', [3]],
            'programYears' => ['programYears', [2]],
            'sessions' => ['sessions', [2]],
            'parents' => ['parents', [2]],
            'children' => ['children', [4], $skipped = true],
            'meshDescriptors' => ['meshDescriptors', ['abc2']],
            'ancestor' => ['ancestor', 1, $skipped = true],
            'descendants' => ['descendants', [2], $skipped = true],
        ];
    }

    /**
     * @inheritDoc
     */
    public function readOnlyPropertiesToTest()
    {
        return [
            'id' => ['id', 1, 99],
        ];
    }

    /**
     * @inheritDoc
     */
    public function filtersToTest()
    {
        return [
            'id' => [[0], ['id' => 1]],
            'title' => [[1], ['title' => 'second objective']],
            'position' => [[0, 1, 2, 3, 4, 5, 6, 7], ['position' => 0]],
            'competency' => [[0], ['competency' => 3]],
            'courses' => [[1, 3], ['courses' => [2]]],
            'programYears' => [[0, 1], ['programYears' => [1]]],
            'sessions' => [[1, 2], ['sessions' => [1]]],
//            'parents' => [[2, 5], ['parents' => [2]]],
//            'children' => [[1], ['children' => [3]]],
//            'meshDescriptors' => [[6], ['meshDescriptors' => ['abc3']]],
            'ancestor' => [[6], ['ancestor' => 6]],
//            'descendants' => [[1], ['descendants' => [3]]],
            'fullCoursesThroughCourse' => [[1, 3], ['fullCourses' => [2]]],
            'fullCoursesThroughSession' => [[1, 2], ['fullCourses' => [1]]],
        ];
    }

    public function testPostCourseObjective()
    {
        $dataLoader = $this->getDataLoader();
        $data = $dataLoader->create();
        $postData = $data;
        $this->relatedPostDataTest($data, $postData, 'objectives', 'courses');
    }

    public function testPostProgramYearObjective()
    {
        $dataLoader = $this->getDataLoader();
        $data = $dataLoader->create();
        $postData = $data;
        $this->relatedPostDataTest($data, $postData, 'objectives', 'programYears');
    }
<commit_msg>fixed up existing objectives filtering test due to change in dummy data.<commit_after><?php

namespace Tests\IliosApiBundle\Endpoints;

use Symfony\Component\HttpFoundation\Response;
use Tests\CoreBundle\DataLoader\ObjectiveData;
use Tests\IliosApiBundle\ReadWriteEndpointTest;

/**
 * Objective API endpoint Test.
 * @group api_5
 */
class ObjectiveTest extends ReadWriteEndpointTest
{
    protected $testName =  'objectives';

    /**
     * @inheritdoc
     */
    protected function getFixtures()
    {
        return [
            'Tests\CoreBundle\Fixture\LoadObjectiveData',
            'Tests\CoreBundle\Fixture\LoadCompetencyData',
            'Tests\CoreBundle\Fixture\LoadCourseData',
            'Tests\CoreBundle\Fixture\LoadProgramYearData',
            'Tests\CoreBundle\Fixture\LoadSessionData',
            'Tests\CoreBundle\Fixture\LoadMeshDescriptorData'
        ];
    }

    /**
     * @inheritDoc
     */
    public function putsToTest()
    {
        return [
            'title' => ['title', $this->getFaker()->text],
            'position' => ['position', $this->getFaker()->randomDigit],
            'competency' => ['competency', 1],
            'courses' => ['courses', [3]],
            'programYears' => ['programYears', [2]],
            'sessions' => ['sessions', [2]],
            'parents' => ['parents', [2]],
            'children' => ['children', [4], $skipped = true],
            'meshDescriptors' => ['meshDescriptors', ['abc2']],
            'ancestor' => ['ancestor', 1, $skipped = true],
            'descendants' => ['descendants', [2], $skipped = true],
        ];
    }

    /**
     * @inheritDoc
     */
    public function readOnlyPropertiesToTest()
    {
        return [
            'id' => ['id', 1, 99],
        ];
    }

    /**
     * @inheritDoc
     */
    public function filtersToTest()
    {
        return [
            'id' => [[0], ['id' => 1]],
            'title' => [[1], ['title' => 'second objective']],
            'position' => [[0, 1, 2, 3, 4, 5, 6, 7], ['position' => 0]],
            'competency' => [[0], ['competency' => 3]],
            'courses' => [[1, 3], ['courses' => [2]]],
            'programYears' => [[0, 1], ['programYears' => [1]]],
            'sessions' => [[2], ['sessions' => [1]]],
//            'parents' => [[2, 5], ['parents' => [2]]],
//            'children' => [[1], ['children' => [3]]],
//            'meshDescriptors' => [[6], ['meshDescriptors' => ['abc3']]],
            'ancestor' => [[6], ['ancestor' => 6]],
//            'descendants' => [[1], ['descendants' => [3]]],
            'fullCoursesThroughCourse' => [[1, 3], ['fullCourses' => [2]]],
            'fullCoursesThroughSession' => [[1, 2], ['fullCourses' => [1]]],
        ];
    }

    public function testPostCourseObjective()
    {
        $dataLoader = $this->getDataLoader();
        $data = $dataLoader->create();
        $postData = $data;
        $this->relatedPostDataTest($data, $postData, 'objectives', 'courses');
    }

    public function testPostProgramYearObjective()
    {
        $dataLoader = $this->getDataLoader();
        $data = $dataLoader->create();
        $postData = $data;
        $this->relatedPostDataTest($data, $postData, 'objectives', 'programYears');
    }

{'fraction_non_alphanumeric': 0.19510684422421803, 'fraction_numerical': 0.016258903685351503, 'mean_word_length': 2.2489939637826963, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 103, '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': '5037637', 'n_tokens_mistral': 2036, 'n_tokens_neox': 1975, 'n_words': 384}