public function testElementName() { $e = new Element('name', 'text', array()); $e->setLabel('First Name'); //stand-alone $this->assertEquals('name', $e->getName()); //under fieldset $fs = m::mock('SH\\Formy\\Fieldset')->shouldReceive('getName')->times(1)->andReturn('customers')->getMock(); $e->setFieldset($fs); $this->assertEquals('customers[name]', $e->getName()); }