Ejemplo n.º 1
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');
 }
Ejemplo n.º 2
0
 /**
  * Test load by name method
  *
  * Since the Magemock_Sample_Model_Vehicle class extends a class-mocker generated
  * class all PHPUnitObjectMock methods are available
  *
  * @return void
  * @test
  */
 public function testLoadByName()
 {
     $vehicle = new \Magemock_Sample_Model_Vehicle();
     $vehicle->expects($this->once())->method('load')->with($this->equalTo('foobar'), $this->equalTo('name'));
     $result = $vehicle->loadByName('foobar');
     $this->assertSame($vehicle, $result, 'loadByName should return $this');
 }