<commit_before><?php namespace Proengsoft\JsValidation\Test;

use Mockery as m;
use Proengsoft\JsValidation\Exceptions\FormRequestArgumentException;
use Proengsoft\JsValidation\Factory;

class FactoryTest extends \PHPUnit_Framework_TestCase {


    public $mockedFactory;
    public $mockedValidator;
    public $factory;
    public $mockedJs;


    public function tearDown()
    {
        m::close();
        unset($this->mockedFactory);
        unset($this->mockedValidator);
        unset($this->factory);
        unset($this->mockedJs);
    }


    public function setUp() {

        $this->mockedFactory =  m::mock('Illuminate\Contracts\Validation\Factory');
        $this->mockedJs= m::mock('Proengsoft\JsValidation\JsValidator');
        $this->mockedJs->shouldReceive('setValidator');
        $this->factory=new Factory($this->mockedFactory,$this->mockedJs);

    }


    public function testMake() {

        $rules=['name'=>'required'];

        $this->mockedFactory->shouldReceive('make')
            ->once()
            ->with([],$rules,[],[])
            ->andReturn(
                m::mock('Illuminate\Contracts\Validation\Validator')
            );
        $this->mockedJs->shouldReceive('setSelector')->once()->andReturn('form');

        $js=$this->factory->make($rules,[],[],'form');

        $this->assertInstanceOf('Proengsoft\JsValidation\JsValidator',$js);

    }


    public function testFormRequestFromInstance() {

        $rules=['name'=>'require'];
        $mockFormRequest=m::mock('Illuminate\Foundation\Http\FormRequest');
        $mockFormRequest->shouldReceive('rules')->once()->andReturn($rules);
        $mockFormRequest->shouldReceive('messages')->once()->andReturn([]);

        $this->mockedFactory->shouldReceive('make')
            ->once()
            ->with([],$rules,[])
            ->andReturn(
                m::mock('Illuminate\Contracts\Validation\Validator')
            );

        $js=$this->factory->formRequest($mockFormRequest);

        $this->assertInstanceOf('Proengsoft\JsValidation\JsValidator',$js);

    }
<commit_msg>Test update<commit_after><?php namespace Proengsoft\JsValidation\Test;

use Mockery as m;
use Proengsoft\JsValidation\Exceptions\FormRequestArgumentException;
use Proengsoft\JsValidation\Factory;

class FactoryTest extends \PHPUnit_Framework_TestCase {


    public $mockedFactory;
    public $mockedValidator;
    public $factory;
    public $mockedJs;


    public function tearDown()
    {
        m::close();
        unset($this->mockedFactory);
        unset($this->mockedValidator);
        unset($this->factory);
        unset($this->mockedJs);
    }


    public function setUp() {

        $this->mockedFactory =  m::mock('Illuminate\Contracts\Validation\Factory');
        $this->mockedJs= m::mock('Proengsoft\JsValidation\JsValidator');
        $this->mockedJs->shouldReceive('setValidator');
        $this->factory=new Factory($this->mockedFactory,$this->mockedJs);

    }


    public function testMake() {

        $rules=['name'=>'required'];

        $this->mockedFactory->shouldReceive('make')
            ->once()
            ->with([],$rules,[],[])
            ->andReturn(
                m::mock('Illuminate\Contracts\Validation\Validator')
            );
        $this->mockedJs->shouldReceive('setSelector')->once()->andReturn('form');

        $js=$this->factory->make($rules,[],[],'form');

        $this->assertInstanceOf('Proengsoft\JsValidation\JsValidator',$js);

    }


    public function testFormRequestFromInstance() {

        $rules=['name'=>'require'];
        $mockFormRequest=m::mock('Illuminate\Foundation\Http\FormRequest');
        $mockFormRequest->shouldReceive('rules')->once()->andReturn($rules);
        $mockFormRequest->shouldReceive('messages')->once()->andReturn([]);
        $mockFormRequest->shouldReceive('attributes')->once()->andReturn([]);

        $this->mockedFactory->shouldReceive('make')
            ->once()
            ->with([],$rules,[],[])
            ->andReturn(
                m::mock('Illuminate\Contracts\Validation\Validator')
            );

        $js=$this->factory->formRequest($mockFormRequest);

        $this->assertInstanceOf('Proengsoft\JsValidation\JsValidator',$js);

    }

{'fraction_non_alphanumeric': 0.16764913935392597, 'fraction_numerical': 0.0, 'mean_word_length': 3.0632183908045976, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 84, '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': '7281927', 'n_tokens_mistral': 1202, 'n_tokens_neox': 1168, 'n_words': 136}