Ejemplo n.º 1
0
 /**
  * Test isBike() method
  *
  * @return void
  * @test
  */
 public function testIsBikeMethod()
 {
     $vehicle = new \Magemock_Sample_Model_Vehicle();
     $this->assertFalse($vehicle->isBike(), 'Vehicle should not be a bike by default');
     $vehicle->setNumberOfWheels(2);
     $vehicle->setNumberOfDoors(0);
     $this->assertTrue($vehicle->isBike(), 'Vehicle should be a bike if it has two wheels and no doors');
 }
Ejemplo n.º 2
0
 /**
  * Test form for existing bikes
  *
  * @return void
  * @test
  */
 public function testFormForBike()
 {
     $vehicle = new Magemock_Sample_Model_Vehicle();
     $vehicle->setNumberOfWheels(2);
     $vehicle->setNumberOfDoors(0);
     $vehicle->setId(1);
     $this->assertTrue($vehicle->isBike());
     $form = new Varien_Data_Form();
     /** @var Magemock_Sample_Block_Adminhtml_Vehicle_Edit_Form|BaseMock $formWidget */
     $formWidget = new Magemock_Sample_Block_Adminhtml_Vehicle_Edit_Form();
     $formWidget->setVehicle($vehicle);
     $formWidget->setForm($form);
     $formWidget->__callProtectedMethod('_prepareForm');
     $this->assertField($form, self::FIELD_ID, 'hidden');
     $fieldset = $form->getElement(self::FIELDSET_BASE);
     $this->assertField($fieldset, self::FIELD_NAME);
     $this->assertFieldNotExist($fieldset, self::FIELD_WHEELS);
     $this->assertFieldNotExist($fieldset, self::FIELD_DOORS);
     $this->assertField($fieldset, self::FIELD_SEATS);
     $this->assertField($fieldset, self::FIELD_TO_SPEED);
     $bikeFieldset = $form->getElement('bike_fieldset');
     $this->assertField($bikeFieldset, 'bike_note', 'note');
 }