@@ 524-542 (lines=19) @@ | ||
521 | * @return void |
|
522 | * @covers ::_getParameter |
|
523 | */ |
|
524 | public function testGetParameterPropertySet() { |
|
525 | $this->_createShellMock( |
|
526 | array('in', 'out', 'hr', 'createFile', 'error', 'err', '_stop', '_showInfo', 'dispatchShell', '_getSeederTasks') |
|
527 | ); |
|
528 | ||
529 | $this->_createShellMock(array('out'), 'PropertiesSetSeederTaskBase'); |
|
530 | ||
531 | $this->_task->expects($this->at(0))->method('out')->with($this->equalTo('Parameter "records" set in class: "50"')); |
|
532 | ||
533 | $configKey = 'records'; |
|
534 | $propertyName = '_records'; |
|
535 | ||
536 | $this->_task->params[$configKey] = null; |
|
537 | Configure::write('FakeSeeder.TestSeederTaskBase.' . $configKey, null); |
|
538 | Configure::write('FakeSeeder.' . $configKey, null); |
|
539 | ||
540 | $result = $this->_task->getParameter($configKey, $propertyName); |
|
541 | $this->assertEquals(50, $result); |
|
542 | } |
|
543 | ||
544 | /** |
|
545 | * Tests the _getParameter method when the general config is set |
|
@@ 550-566 (lines=17) @@ | ||
547 | * @return void |
|
548 | * @covers ::_getParameter |
|
549 | */ |
|
550 | public function testGetParameterGeneralConfgigSet() { |
|
551 | $this->_createShellMock( |
|
552 | array('in', 'out', 'hr', 'createFile', 'error', 'err', '_stop', '_showInfo', 'dispatchShell', '_getSeederTasks') |
|
553 | ); |
|
554 | ||
555 | $this->_task->expects($this->at(0))->method('out')->with($this->equalTo('Parameter "records" configured in general seeder configuration: "75"')); |
|
556 | ||
557 | $configKey = 'records'; |
|
558 | $propertyName = '_records'; |
|
559 | ||
560 | $this->_task->params[$configKey] = null; |
|
561 | Configure::write('FakeSeeder.TestSeederTaskBase.' . $configKey, null); |
|
562 | Configure::write('FakeSeeder.' . $configKey, 75); |
|
563 | ||
564 | $result = $this->_task->getParameter($configKey, $propertyName); |
|
565 | $this->assertEquals(75, $result); |
|
566 | } |
|
567 | ||
568 | /** |
|
569 | * Tests the _getParameter method when the seeder specific config is set |
|
@@ 601-617 (lines=17) @@ | ||
598 | * @return void |
|
599 | * @covers ::_getParameter |
|
600 | */ |
|
601 | public function testGetParameterParameterSet() { |
|
602 | $this->_createShellMock( |
|
603 | array('in', 'out', 'hr', 'createFile', 'error', 'err', '_stop', '_showInfo', 'dispatchShell', '_getSeederTasks') |
|
604 | ); |
|
605 | ||
606 | $this->_task->expects($this->at(0))->method('out')->with($this->equalTo('Parameter "records" given through CLI parameter: "24"')); |
|
607 | ||
608 | $configKey = 'records'; |
|
609 | $propertyName = '_records'; |
|
610 | ||
611 | $this->_task->params[$configKey] = 24; |
|
612 | Configure::write('FakeSeeder.TestSeederTaskBase.' . $configKey, null); |
|
613 | Configure::write('FakeSeeder.' . $configKey, null); |
|
614 | ||
615 | $result = $this->_task->getParameter($configKey, $propertyName); |
|
616 | $this->assertEquals(24, $result); |
|
617 | } |
|
618 | ||
619 | /** |
|
620 | * Tests the _getSeederConfigKey method |