public function testCollect() { $toggle1 = new Toggle(); $toggle2 = new Toggle(); $label = new Label(); $label->addScriptFeature($toggle2); $this->assertEmpty(ScriptFeature::collect(null)); $this->assertEquals(array($toggle1), ScriptFeature::collect($toggle1)); $this->assertEquals(array($toggle2), ScriptFeature::collect($label)); $this->assertEquals(array($toggle1, $toggle2), ScriptFeature::collect($toggle1, $label)); }
/** * @see ScriptFeatureable::getScriptFeatures() */ public function getScriptFeatures() { return ScriptFeature::collect($this->feature, $this->getLabel(), $this->feature->getEntry()); }
/** * Load the given Script Feature * * @param ScriptFeature $scriptFeature Script Feature to load * @return static */ public function loadFeature(ScriptFeature $scriptFeature) { $scriptFeature->prepare($this); return $this; }