Exemplo n.º 1
0
 /**
  * Test the JForm::loadFieldType method.
  *
  * @return void
  */
 public function testLoadFieldType()
 {
     $inspector = new JFormInspector('test');
     $this->assertThat($inspector->loadFieldType('bogus'), $this->isFalse(), 'Line:' . __LINE__ . ' loadFieldType should return false if class not found.');
     $this->assertThat($inspector->loadFieldType('list') instanceof JFormFieldList, $this->isTrue(), 'Line:' . __LINE__ . ' loadFieldType should return the correct class.');
     // Add custom path.
     JForm::addFieldPath(__DIR__ . '/_testfields');
     $this->assertThat($inspector->loadFieldType('test') instanceof JFormFieldTest, $this->isTrue(), 'Line:' . __LINE__ . ' loadFieldType should return the correct custom class.');
     $this->assertThat($inspector->loadFieldType('foo.bar') instanceof FooFormFieldBar, $this->isTrue(), 'Line:' . __LINE__ . ' loadFieldType should return the correct custom class.');
     $this->assertThat($inspector->loadFieldType('modal_foo') instanceof JFormFieldModal_Foo, $this->isTrue(), 'Line:' . __LINE__ . ' loadFieldType should return the correct custom class.');
     $this->assertThat($inspector->loadFieldType('foo.modal_bar') instanceof FooFormFieldModal_Bar, $this->isTrue(), 'Line:' . __LINE__ . ' loadFieldType should return the correct custom class.');
 }
Exemplo n.º 2
0
 /**
  * Test the JForm::loadFieldType method.
  */
 public function testLoadFieldType()
 {
     $this->assertThat(JFormInspector::loadFieldType('bogus'), $this->isFalse(), 'Line:' . __LINE__ . ' loadFieldType should return false if class not found.');
     $this->assertThat(JFormInspector::loadFieldType('list') instanceof JFormFieldList, $this->isTrue(), 'Line:' . __LINE__ . ' loadFieldType should return the correct class.');
     // Add custom path.
     JForm::addFieldPath(dirname(__FILE__) . '/_testfields');
     $this->assertThat(JFormInspector::loadFieldType('test') instanceof JFormFieldTest, $this->isTrue(), 'Line:' . __LINE__ . ' loadFieldType should return the correct custom class.');
 }