public function testEnableRangeSearchInt()
 {
     $_REQUEST['view_module'] = 'Opportunities';
     $_REQUEST['name'] = 'probability';
     $templateDate = new TemplateInt();
     $templateDate->enable_range_search = true;
     $templateDate->populateFromPost();
     $this->assertTrue(file_exists('custom/modules/Opportunities/metadata/SearchFields.php'));
     include 'custom/modules/Opportunities/metadata/SearchFields.php';
     $this->assertTrue(isset($searchFields['Opportunities']['range_probability']));
     $this->assertTrue(isset($searchFields['Opportunities']['start_range_probability']));
     $this->assertTrue(isset($searchFields['Opportunities']['end_range_probability']));
     $this->assertTrue(!isset($searchFields['Opportunities']['range_probability']['is_date_field']));
     $this->assertTrue(!isset($searchFields['Opportunities']['start_range_probability']['is_date_field']));
     $this->assertTrue(!isset($searchFields['Opportunities']['end_range_probability']['is_date_field']));
 }
Beispiel #2
0
 /**
  * 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');
 }
Beispiel #3
0
 /**
  * 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');
         }
     }
 }