diff options
author | Andrew Dolgov <[email protected]> | 2022-12-13 20:08:43 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2022-12-13 20:08:43 +0300 |
commit | 8ea537123d1cef38f25f9fbe92e3a9c0f89de55a (patch) | |
tree | 0b40ea733af15c1f33403e42afc8afa14d48b87c /plugins/af_readability/vendor/fivefilters/readability.php/test/ConfigurationTest.php | |
parent | 313f12ae9306fc62bbbfa10310a2feb20aa274c5 (diff) |
move af_readability out of master tree
Diffstat (limited to 'plugins/af_readability/vendor/fivefilters/readability.php/test/ConfigurationTest.php')
-rw-r--r-- | plugins/af_readability/vendor/fivefilters/readability.php/test/ConfigurationTest.php | 92 |
1 files changed, 0 insertions, 92 deletions
diff --git a/plugins/af_readability/vendor/fivefilters/readability.php/test/ConfigurationTest.php b/plugins/af_readability/vendor/fivefilters/readability.php/test/ConfigurationTest.php deleted file mode 100644 index d08065fab..000000000 --- a/plugins/af_readability/vendor/fivefilters/readability.php/test/ConfigurationTest.php +++ /dev/null @@ -1,92 +0,0 @@ -<?php - -namespace fivefilters\Readability\Test; - -use fivefilters\Readability\Configuration; -use Monolog\Handler\NullHandler; -use Monolog\Logger; - -/** - * Class ConfigurationTest. - */ -class ConfigurationTest extends \PHPUnit\Framework\TestCase -{ - /** - * @dataProvider getParams - * - * @param array $params - */ - public function testConfigurationConstructorSetsParameters(array $params) - { - $config = new Configuration($params); - $this->doEqualsAsserts($config, $params); - } - - /** - * @dataProvider getParams - * - * @param array $params - */ - public function testInvalidParameterIsNotInConfig(array $params) - { - $config = new Configuration($params); - $this->assertArrayNotHasKey('invalidParameter', $config->toArray(), 'Invalid param key is not present in config'); - } - - /** - * @param Configuration $config - * @param array $options - */ - private function doEqualsAsserts(Configuration $config, array $options) - { - $this->assertEquals($options['maxTopCandidates'], $config->getMaxTopCandidates()); - $this->assertEquals($options['charThreshold'], $config->getCharThreshold()); - $this->assertEquals($options['articleByLine'], $config->getArticleByLine()); - $this->assertEquals($options['stripUnlikelyCandidates'], $config->getStripUnlikelyCandidates()); - $this->assertEquals($options['cleanConditionally'], $config->getCleanConditionally()); - $this->assertEquals($options['weightClasses'], $config->getWeightClasses()); - $this->assertEquals($options['fixRelativeURLs'], $config->getFixRelativeURLs()); - $this->assertEquals($options['substituteEntities'], $config->getSubstituteEntities()); - $this->assertEquals($options['normalizeEntities'], $config->getNormalizeEntities()); - $this->assertEquals($options['originalURL'], $config->getOriginalURL()); - $this->assertEquals($options['summonCthulhu'], $config->getOriginalURL()); - } - - /** - * @return array - */ - public function getParams() - { - return [[ - 'All current parameters' => [ - 'maxTopCandidates' => 3, - 'wordThreshold' => 500, - 'charThreshold' => 500, - 'articleByLine' => true, - 'stripUnlikelyCandidates' => false, - 'cleanConditionally' => false, - 'weightClasses' => false, - 'fixRelativeURLs' => true, - 'substituteEntities' => true, - 'normalizeEntities' => true, - 'originalURL' => 'my.original.url', - 'summonCthulhu' => 'my.original.url', - 'invalidParameter' => 'invalidParameterValue' - ] - ]]; - } - - /** - * Test if a logger interface can be injected and retrieved from the Configuration object. - */ - public function testLoggerCanBeInjected() - { - $configuration = new Configuration(); - $log = new Logger('Readability'); - $log->pushHandler(new NullHandler()); - - $configuration->setLogger($log); - - $this->assertSame($log, $configuration->getLogger()); - } -} |