/** * @group Slow * @slowExecutionTime 0.07819 ms * @covers Wikia\Search\Field\Field::__toString() */ public function test__toString() { $field = new Field\Field('html', 'en'); $this->assertEquals('html_en', $field->__toString()); $field = new Field\Field('html', 'zzzz'); $this->assertEquals('html', $field->__toString()); $field = new Field\Field('redirect_titles', 'en'); $this->assertEquals('redirect_titles_mv_en', $field->__toString()); }
/** * Accepts a string and, checks it against a known set of dynamic language fields, and composes * a field namebased on the language context and field set membership. * @param string $field * @param string $lang the non-global language code, if needed * @return string the dynamic field, or the field name if not dynamic **/ public static function field($field, $lang = null) { $field = new Field\Field($field, $lang); return $field->__toString(); }