/** * Test asserts that after addField call validator added to both values and has min value, because of min value more than max * * @group 56694 */ public function testAddFieldForFieldWithInvertedMaxMin() { $this->templateInt->min = 6; $this->templateInt->max = 5; $this->bean->field_name_map[$this->templateInt->name] = $this->templateInt->get_field_def(); $this->javascript->addField($this->templateInt->name, $this->templateInt->required); $this->assertNotEmpty($this->javascript->getData(), 'Validator is not added'); $actual = $this->javascript->getData(); $this->assertSame(array($this->templateInt->min, $this->templateInt->min), $actual, 'Min value is incorrect'); }
/** * Test checks min & max range for validator for int field * * @param mixed $min value * @param mixed $max max * @param bool $isValidation is validation required * @param bool $isMin is min value present * @param bool $isMax is max value present * * @dataProvider getMaxMin * @group 56694 */ public function testGetFieldDefByExt($min, $max, $isValidation, $isMin, $isMax) { $this->templateInt->ext1 = $min; $this->templateInt->ext2 = $max; $vardef = $this->templateInt->get_field_def(); if ($isValidation == false) { $this->assertArrayNotHasKey('validation', $vardef, 'Validation is required'); } else { $this->assertArrayHasKey('validation', $vardef, 'Validation is not required'); if ($isMin == true) { $this->assertEquals($min, $vardef['validation']['min'], 'Min value is incorrect'); } else { $this->assertEquals(false, $vardef['validation']['min'], 'Min value is present'); } if ($isMax == true) { $this->assertEquals($max, $vardef['validation']['max'], 'Max value is incorrect'); } else { $this->assertEquals(false, $vardef['validation']['max'], 'Max value is present'); } } }