Skip to content
This repository
Browse code

Remove more copy + paste in tests.

  • Loading branch information...
commit 7846254c632e90cba2a4ac2c0a1065326be17848 1 parent 88465cb
Mark Story authored April 21, 2012
122  lib/Cake/Test/Case/View/Helper/FormHelperTest.php
@@ -4727,84 +4727,12 @@ public function testDateTime() {
4727 4727
 		);
4728 4728
 		$this->assertTags($result, $expected);
4729 4729
 		$this->assertNotRegExp('/<option[^<>]+value=""[^<>]+selected="selected"[^>]*>/', $result);
4730  
-
  4730
+	
4731 4731
 		$result = $this->Form->dateTime('Contact.date', 'DMY', '12', array('value' => false));
4732  
-		$expected = array(
4733  
-			array('select' => array('name' => 'data[Contact][date][day]', 'id' => 'ContactDateDay')),
4734  
-			$daysRegex,
4735  
-			array('option' => array('value' => '')),
4736  
-			'/option',
4737  
-			'*/select',
4738  
-			'-',
4739  
-			array('select' => array('name' => 'data[Contact][date][month]', 'id' => 'ContactDateMonth')),
4740  
-			$monthsRegex,
4741  
-			array('option' => array('value' => '')),
4742  
-			'/option',
4743  
-			'*/select',
4744  
-			'-',
4745  
-			array('select' => array('name' => 'data[Contact][date][year]', 'id' => 'ContactDateYear')),
4746  
-			$yearsRegex,
4747  
-			array('option' => array('value' => '')),
4748  
-			'/option',
4749  
-			'*/select',
4750  
-			array('select' => array('name' => 'data[Contact][date][hour]', 'id' => 'ContactDateHour')),
4751  
-			$hoursRegex,
4752  
-			array('option' => array('value' => '')),
4753  
-			'/option',
4754  
-			'*/select',
4755  
-			':',
4756  
-			array('select' => array('name' => 'data[Contact][date][min]', 'id' => 'ContactDateMin')),
4757  
-			$minutesRegex,
4758  
-			array('option' => array('value' => '')),
4759  
-			'/option',
4760  
-			'*/select',
4761  
-			' ',
4762  
-			array('select' => array('name' => 'data[Contact][date][meridian]', 'id' => 'ContactDateMeridian')),
4763  
-			$meridianRegex,
4764  
-			array('option' => array('value' => '')),
4765  
-			'/option',
4766  
-			'*/select'
4767  
-		);
4768 4732
 		$this->assertTags($result, $expected);
4769 4733
 		$this->assertNotRegExp('/<option[^<>]+value=""[^<>]+selected="selected"[^>]*>/', $result);
4770 4734
 
4771 4735
 		$result = $this->Form->dateTime('Contact.date', 'DMY', '12', array('value' => ''));
4772  
-		$expected = array(
4773  
-			array('select' => array('name' => 'data[Contact][date][day]', 'id' => 'ContactDateDay')),
4774  
-			$daysRegex,
4775  
-			array('option' => array('value' => '')),
4776  
-			'/option',
4777  
-			'*/select',
4778  
-			'-',
4779  
-			array('select' => array('name' => 'data[Contact][date][month]', 'id' => 'ContactDateMonth')),
4780  
-			$monthsRegex,
4781  
-			array('option' => array('value' => '')),
4782  
-			'/option',
4783  
-			'*/select',
4784  
-			'-',
4785  
-			array('select' => array('name' => 'data[Contact][date][year]', 'id' => 'ContactDateYear')),
4786  
-			$yearsRegex,
4787  
-			array('option' => array('value' => '')),
4788  
-			'/option',
4789  
-			'*/select',
4790  
-			array('select' => array('name' => 'data[Contact][date][hour]', 'id' => 'ContactDateHour')),
4791  
-			$hoursRegex,
4792  
-			array('option' => array('value' => '')),
4793  
-			'/option',
4794  
-			'*/select',
4795  
-			':',
4796  
-			array('select' => array('name' => 'data[Contact][date][min]', 'id' => 'ContactDateMin')),
4797  
-			$minutesRegex,
4798  
-			array('option' => array('value' => '')),
4799  
-			'/option',
4800  
-			'*/select',
4801  
-			' ',
4802  
-			array('select' => array('name' => 'data[Contact][date][meridian]', 'id' => 'ContactDateMeridian')),
4803  
-			$meridianRegex,
4804  
-			array('option' => array('value' => '')),
4805  
-			'/option',
4806  
-			'*/select'
4807  
-		);
4808 4736
 		$this->assertTags($result, $expected);
4809 4737
 		$this->assertNotRegExp('/<option[^<>]+value=""[^<>]+selected="selected"[^>]*>/', $result);
4810 4738
 
@@ -4858,53 +4786,7 @@ public function testDateTime() {
4858 4786
 		$this->assertNotRegExp('/<option[^<>]+value=""[^<>]+selected="selected"[^>]*>/', $result);
4859 4787
 
4860 4788
 		$result = $this->Form->dateTime('Contact.date', 'DMY', '12', array('minuteInterval' => 5, 'value' => ''));
4861  
-		$expected = array(
4862  
-			array('select' => array('name' => 'data[Contact][date][day]', 'id' => 'ContactDateDay')),
4863  
-			$daysRegex,
4864  
-			array('option' => array('value' => '')),
4865  
-			'/option',
4866  
-			'*/select',
4867  
-			'-',
4868  
-			array('select' => array('name' => 'data[Contact][date][month]', 'id' => 'ContactDateMonth')),
4869  
-			$monthsRegex,
4870  
-			array('option' => array('value' => '')),
4871  
-			'/option',
4872  
-			'*/select',
4873  
-			'-',
4874  
-			array('select' => array('name' => 'data[Contact][date][year]', 'id' => 'ContactDateYear')),
4875  
-			$yearsRegex,
4876  
-			array('option' => array('value' => '')),
4877  
-			'/option',
4878  
-			'*/select',
4879  
-			array('select' => array('name' => 'data[Contact][date][hour]', 'id' => 'ContactDateHour')),
4880  
-			$hoursRegex,
4881  
-			array('option' => array('value' => '')),
4882  
-			'/option',
4883  
-			'*/select',
4884  
-			':',
4885  
-			array('select' => array('name' => 'data[Contact][date][min]', 'id' => 'ContactDateMin')),
4886  
-			$minutesRegex,
4887  
-			array('option' => array('value' => '')),
4888  
-			'/option',
4889  
-			array('option' => array('value' => '00')),
4890  
-			'00',
4891  
-			'/option',
4892  
-			array('option' => array('value' => '05')),
4893  
-			'05',
4894  
-			'/option',
4895  
-			array('option' => array('value' => '10')),
4896  
-			'10',
4897  
-			'/option',
4898  
-			'*/select',
4899  
-			' ',
4900  
-			array('select' => array('name' => 'data[Contact][date][meridian]', 'id' => 'ContactDateMeridian')),
4901  
-			$meridianRegex,
4902  
-			array('option' => array('value' => '')),
4903  
-			'/option',
4904  
-			'*/select'
4905  
-		);
4906  
-		$this->assertTags($result, $expected);
4907  
-		$this->assertNotRegExp('/<option[^<>]+value=""[^<>]+selected="selected"[^>]*>/', $result);
  4789
+		$result = $this->Form->dateTime('Contact.date', 'DMY', '12', array('minuteInterval' => 5, 'value' => ''));
4908 4790
 
4909 4791
 		$this->Form->request->data['Contact']['data'] = null;
4910 4792
 		$result = $this->Form->dateTime('Contact.date', 'DMY', '12');

0 notes on commit 7846254

Please sign in to comment.
Something went wrong with that request. Please try again.