2019-08-25 17:55:34 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
/**
|
language: Widen `@covers` tags in phpunit tests
Add a few missing `@group Language` tags as well.
Remove stray `@group Cache` from two classes since "Cache" is not a
MediaWiki core component (per T248519 and related tasks, we did long
ago in Bugzilla have a "MediaWiki-Cache" category, but that's since
been re-orged into BagOStuff, HTTP-Cache, and Parser/ParserCache,
and Internationalization/LocalisationCache, per the description at
<https://phabricator.wikimedia.org/project/profile/1329/>.)
Ref https://gerrit.wikimedia.org/r/q/owner:Krinkle+is:merged+message:Widen
> Given all called methods are de-facto and liberally claimed, and
> that we keep the coverage limited to the subject class, it maintains
> the spirit and intent by listing the class explicitly instead.
>
> PHPUnit offers a more precise tool when you need it (i.e. when testing
> legacy monster/god classes), but for well-written code, the
> class-wide tag is exactly what you want.
>
> We lose useful coverage and waste valuable time on keeping tags
> accurate through refactors (or worse, forget to do so).
> Tracking tiny per-method details wastes time in realizing (and
> fixing) when people inevitably don't keep them in sync, and time
> lost in finding uncovered code to write tests to realize it was
> already covered but "not yet claimed".
Bug: T364652
Change-Id: I9cfc4c210b90bfed6fd988a2525f80f5f5ee4870
2024-06-14 19:51:04 +00:00
|
|
|
* @group Language
|
2024-02-16 18:04:47 +00:00
|
|
|
* @covers \ConverterRule
|
2019-08-25 17:55:34 +00:00
|
|
|
*/
|
2020-06-30 15:09:24 +00:00
|
|
|
class ConverterRuleTest extends MediaWikiIntegrationTestCase {
|
2019-08-25 17:55:34 +00:00
|
|
|
|
|
|
|
|
public function testParseEmpty() {
|
2024-07-20 19:46:39 +00:00
|
|
|
$lang = $this->getServiceContainer()->getLanguageFactory()->getLanguage( 'en' );
|
|
|
|
|
$converter = new EnConverter( $lang );
|
2019-08-25 17:55:34 +00:00
|
|
|
$rule = new ConverterRule( '', $converter );
|
|
|
|
|
$rule->parse();
|
|
|
|
|
|
|
|
|
|
$this->assertSame( false, $rule->getTitle(), 'title' );
|
|
|
|
|
$this->assertSame( [], $rule->getConvTable(), 'conversion table' );
|
|
|
|
|
$this->assertSame( 'none', $rule->getRulesAction(), 'rules action' );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|