diff --git a/src/Forms/PrintableTransformation_TabSet.php b/src/Forms/PrintableTransformation_TabSet.php index f25598e5a..2be4f72d7 100644 --- a/src/Forms/PrintableTransformation_TabSet.php +++ b/src/Forms/PrintableTransformation_TabSet.php @@ -19,9 +19,9 @@ class PrintableTransformation_TabSet extends TabSet public function FieldHolder($properties = array()) { // This gives us support for sub-tabs. - $tag = ($this->tabSet) ? "h2>" : "h1>"; + $tag = $this->getTabSet() ? 'h2>' : 'h1>'; $retVal = ''; - foreach ($this->children as $tab) { + foreach ($this->getChildren() as $tab) { $retVal .= "<$tag" . $tab->Title() . "FieldHolder(); } diff --git a/src/Forms/TabSet.php b/src/Forms/TabSet.php index da18e9d48..dc0b60217 100644 --- a/src/Forms/TabSet.php +++ b/src/Forms/TabSet.php @@ -106,9 +106,8 @@ class TabSet extends CompositeField { if ($this->tabSet) { return $this->tabSet->ID() . '_' . $this->id . '_set'; - } else { - return $this->id; } + return $this->id; } /** diff --git a/tests/php/Forms/DisabledTransformationTest.php b/tests/php/Forms/DisabledTransformationTest.php new file mode 100644 index 000000000..74b460f39 --- /dev/null +++ b/tests/php/Forms/DisabledTransformationTest.php @@ -0,0 +1,20 @@ +transform($field); + + $this->assertTrue($newField->isDisabled(), 'Transformation failed to transform field to be disabled'); + } +} diff --git a/tests/php/Forms/PrintableTransformationTest.php b/tests/php/Forms/PrintableTransformationTest.php new file mode 100644 index 000000000..8a54d8d49 --- /dev/null +++ b/tests/php/Forms/PrintableTransformationTest.php @@ -0,0 +1,25 @@ +transformTabSet($tabSet); + + $this->assertInstanceOf(PrintableTransformation_TabSet::class, $result); + $this->assertSame('Root', $result->Title()); + } +} diff --git a/tests/php/Forms/PrintableTransformation_TabSetTest.php b/tests/php/Forms/PrintableTransformation_TabSetTest.php new file mode 100644 index 000000000..11ca4efd8 --- /dev/null +++ b/tests/php/Forms/PrintableTransformation_TabSetTest.php @@ -0,0 +1,36 @@ +FieldHolder(); + + $this->assertContains('

Main

', $result); + $this->assertContains('

Secondary

', $result); + + $transformationTabSet->setTabSet($optionsTabSet); + $result = $transformationTabSet->FieldHolder(); + + $this->assertContains('

Options

', $result); + } +}