<commit_before><?php
/**
 * @license see LICENSE
 */

namespace UForm\Test\Form\Element\Primary\Input;

use UForm\Form\Element\Primary\Input\Check;

class CheckTest extends \PHPUnit_Framework_TestCase
{

    public function testConstruct()
    {
        $input = new Check("inputname", "yes");
        $this->assertTrue($input->hasSemanticType("input:checkbox"));
    }

    public function testRender()
    {
        $input = new Check("inputname", "yes");
        $render = $input->render(["inputname" => "yes"], ["inputname" => "yes"]);

        $expected = '<input type="checkbox" name="inputname" value="yes" checked="checked"/>';
        $this->assertEquals($expected, $render);
    }
}<commit_msg>Checkbox test<commit_after><?php
/**
 * @license see LICENSE
 */

namespace UForm\Test\Form\Element\Primary\Input;

use UForm\Form\Element\Primary\Input\Check;

class CheckTest extends \PHPUnit_Framework_TestCase
{

    public function testConstruct()
    {
        $input = new Check("inputname", "yes");
        $this->assertTrue($input->hasSemanticType("input:checkbox"));
    }

    public function testRender()
    {
        $input = new Check("inputname", "yes");
        $render = $input->render(["inputname" => "yes"], ["inputname" => "yes"]);
        $expected = '<input type="checkbox" name="inputname" value="yes" checked="checked"/>';
        $this->assertEquals($expected, $render);

        // no value
        $input = new Check("inputname");
        $render = $input->render(["inputname" => "yes"], ["inputname" => "yes"]);
        $expected = '<input type="checkbox" name="inputname"/>';
        $this->assertEquals($expected, $render);
    }
}
{'fraction_non_alphanumeric': 0.18198198198198198, 'fraction_numerical': 0.0, 'mean_word_length': 3.4664879356568363, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 22, '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': '1693043', 'n_tokens_mistral': 489, 'n_tokens_neox': 485, 'n_words': 97}