Skip to content

Commit

Permalink
#111. Add more coverage on SpellCheckTrait
Browse files Browse the repository at this point in the history
  • Loading branch information
arthurkushman committed Jun 7, 2018
1 parent 7c24cec commit 69167be
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 57 deletions.
114 changes: 57 additions & 57 deletions clover.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<coverage generated="1528310477">
<project timestamp="1528310477">
<coverage generated="1528353804">
<project timestamp="1528353804">
<package name="rjapi">
<file name="/srv/raml-json-api/src/RJApiGenerator.php">
<class name="rjapi\RJApiGenerator" namespace="rjapi">
Expand Down Expand Up @@ -671,17 +671,17 @@
</file>
<file name="/srv/raml-json-api/src/blocks/FileManager.php">
<class name="rjapi\blocks\FileManager" namespace="rjapi\blocks">
<metrics complexity="14" methods="7" coveredmethods="5" conditionals="0" coveredconditionals="0" statements="30" coveredstatements="21" elements="37" coveredelements="26"/>
<metrics complexity="14" methods="7" coveredmethods="5" conditionals="0" coveredconditionals="0" statements="30" coveredstatements="22" elements="37" coveredelements="27"/>
</class>
<line num="26" type="method" name="createFile" visibility="public" complexity="3" crap="3" count="9"/>
<line num="28" type="stmt" count="9"/>
<line num="30" type="stmt" count="7"/>
<line num="31" type="stmt" count="7"/>
<line num="33" type="stmt" count="7"/>
<line num="36" type="stmt" count="4"/>
<line num="44" type="method" name="createPath" visibility="public" complexity="3" crap="6.80" count="1"/>
<line num="44" type="method" name="createPath" visibility="public" complexity="3" crap="5.20" count="1"/>
<line num="46" type="stmt" count="1"/>
<line num="48" type="stmt" count="0"/>
<line num="48" type="stmt" count="1"/>
<line num="50" type="stmt" count="0"/>
<line num="52" type="stmt" count="0"/>
<line num="53" type="stmt" count="0"/>
Expand Down Expand Up @@ -710,7 +710,7 @@
<line num="126" type="stmt" count="0"/>
<line num="127" type="stmt" count="0"/>
<line num="128" type="stmt" count="0"/>
<metrics loc="129" ncloc="90" classes="1" methods="7" coveredmethods="5" conditionals="0" coveredconditionals="0" statements="30" coveredstatements="21" elements="37" coveredelements="26"/>
<metrics loc="129" ncloc="90" classes="1" methods="7" coveredmethods="5" conditionals="0" coveredconditionals="0" statements="30" coveredstatements="22" elements="37" coveredelements="27"/>
</file>
<file name="/srv/raml-json-api/src/blocks/FormRequestModel.php">
<class name="rjapi\blocks\FormRequestModel" namespace="rjapi\blocks">
Expand Down Expand Up @@ -2391,48 +2391,48 @@
<class name="rjapi\extension\SpellCheck" namespace="rjapi\extension">
<metrics complexity="11" methods="6" coveredmethods="6" conditionals="0" coveredconditionals="0" statements="20" coveredstatements="20" elements="26" coveredelements="26"/>
</class>
<line num="21" type="method" name="__construct" visibility="public" complexity="4" crap="4" count="4"/>
<line num="23" type="stmt" count="4"/>
<line num="24" type="stmt" count="4"/>
<line num="25" type="stmt" count="4"/>
<line num="26" type="stmt" count="4"/>
<line num="27" type="stmt" count="4"/>
<line num="28" type="stmt" count="4"/>
<line num="29" type="stmt" count="4"/>
<line num="31" type="stmt" count="4"/>
<line num="39" type="method" name="check" visibility="public" complexity="3" crap="3" count="1"/>
<line num="41" type="stmt" count="1"/>
<line num="42" type="stmt" count="1"/>
<line num="43" type="stmt" count="1"/>
<line num="44" type="stmt" count="1"/>
<line num="45" type="stmt" count="1"/>
<line num="46" type="stmt" count="1"/>
<line num="47" type="stmt" count="1"/>
<line num="50" type="stmt" count="1"/>
<line num="57" type="method" name="cleanText" visibility="private" complexity="1" crap="1" count="1"/>
<line num="59" type="stmt" count="1"/>
<line num="65" type="method" name="isEnabled" visibility="public" complexity="1" crap="1" count="1"/>
<line num="67" type="stmt" count="1"/>
<line num="21" type="method" name="__construct" visibility="public" complexity="4" crap="4" count="5"/>
<line num="23" type="stmt" count="5"/>
<line num="24" type="stmt" count="5"/>
<line num="25" type="stmt" count="5"/>
<line num="26" type="stmt" count="5"/>
<line num="27" type="stmt" count="5"/>
<line num="28" type="stmt" count="5"/>
<line num="29" type="stmt" count="5"/>
<line num="31" type="stmt" count="5"/>
<line num="39" type="method" name="check" visibility="public" complexity="3" crap="3" count="2"/>
<line num="41" type="stmt" count="2"/>
<line num="42" type="stmt" count="2"/>
<line num="43" type="stmt" count="2"/>
<line num="44" type="stmt" count="2"/>
<line num="45" type="stmt" count="2"/>
<line num="46" type="stmt" count="2"/>
<line num="47" type="stmt" count="2"/>
<line num="50" type="stmt" count="2"/>
<line num="57" type="method" name="cleanText" visibility="private" complexity="1" crap="1" count="2"/>
<line num="59" type="stmt" count="2"/>
<line num="65" type="method" name="isEnabled" visibility="public" complexity="1" crap="1" count="2"/>
<line num="67" type="stmt" count="2"/>
<line num="73" type="method" name="getLanguage" visibility="public" complexity="1" crap="1" count="1"/>
<line num="75" type="stmt" count="1"/>
<line num="81" type="method" name="getField" visibility="public" complexity="1" crap="1" count="1"/>
<line num="83" type="stmt" count="1"/>
<line num="81" type="method" name="getField" visibility="public" complexity="1" crap="1" count="2"/>
<line num="83" type="stmt" count="2"/>
<metrics loc="84" ncloc="61" classes="1" methods="6" coveredmethods="6" conditionals="0" coveredconditionals="0" statements="20" coveredstatements="20" elements="26" coveredelements="26"/>
</file>
<file name="/srv/raml-json-api/src/extension/SpellCheckTrait.php">
<class name="SpellCheckTrait" namespace="rjapi\extension" fullPackage="rjapi" package="rjapi">
<metrics complexity="3" methods="1" coveredmethods="0" conditionals="0" coveredconditionals="0" statements="8" coveredstatements="0" elements="9" coveredelements="0"/>
<metrics complexity="3" methods="1" coveredmethods="0" conditionals="0" coveredconditionals="0" statements="8" coveredstatements="7" elements="9" coveredelements="7"/>
</class>
<line num="23" type="method" name="spellCheck" visibility="protected" complexity="3" crap="12" count="0"/>
<line num="25" type="stmt" count="0"/>
<line num="23" type="method" name="spellCheck" visibility="protected" complexity="3" crap="3.02" count="1"/>
<line num="25" type="stmt" count="1"/>
<line num="26" type="stmt" count="0"/>
<line num="28" type="stmt" count="0"/>
<line num="29" type="stmt" count="0"/>
<line num="30" type="stmt" count="0"/>
<line num="31" type="stmt" count="0"/>
<line num="32" type="stmt" count="0"/>
<line num="35" type="stmt" count="0"/>
<metrics loc="36" ncloc="22" classes="1" methods="1" coveredmethods="0" conditionals="0" coveredconditionals="0" statements="8" coveredstatements="0" elements="9" coveredelements="0"/>
<line num="28" type="stmt" count="1"/>
<line num="29" type="stmt" count="1"/>
<line num="30" type="stmt" count="1"/>
<line num="31" type="stmt" count="1"/>
<line num="32" type="stmt" count="1"/>
<line num="35" type="stmt" count="1"/>
<metrics loc="36" ncloc="22" classes="1" methods="1" coveredmethods="0" conditionals="0" coveredconditionals="0" statements="8" coveredstatements="7" elements="9" coveredelements="7"/>
</file>
<file name="/srv/raml-json-api/src/extension/StateMachine.php">
<class name="rjapi\extension\StateMachine" namespace="rjapi\extension">
Expand Down Expand Up @@ -2500,22 +2500,22 @@
<class name="rjapi\helpers\ConfigHelper" namespace="rjapi\helpers">
<metrics complexity="8" methods="4" coveredmethods="4" conditionals="0" coveredconditionals="0" statements="12" coveredstatements="12" elements="16" coveredelements="16"/>
</class>
<line num="19" type="method" name="getConfigKey" visibility="public" complexity="1" crap="1" count="19"/>
<line num="21" type="stmt" count="19"/>
<line num="22" type="stmt" count="19"/>
<line num="24" type="stmt" count="19"/>
<line num="19" type="method" name="getConfigKey" visibility="public" complexity="1" crap="1" count="20"/>
<line num="21" type="stmt" count="20"/>
<line num="22" type="stmt" count="20"/>
<line num="24" type="stmt" count="20"/>
<line num="27" type="method" name="getModuleName" visibility="public" complexity="1" crap="1" count="3"/>
<line num="29" type="stmt" count="3"/>
<line num="32" type="method" name="getQueryParam" visibility="public" complexity="3" crap="3" count="2"/>
<line num="34" type="stmt" count="2"/>
<line num="35" type="stmt" count="2"/>
<line num="37" type="stmt" count="2"/>
<line num="40" type="stmt" count="1"/>
<line num="43" type="method" name="getNestedParam" visibility="public" complexity="3" crap="3" count="15"/>
<line num="45" type="stmt" count="15"/>
<line num="43" type="method" name="getNestedParam" visibility="public" complexity="3" crap="3" count="16"/>
<line num="45" type="stmt" count="16"/>
<line num="46" type="stmt" count="2"/>
<line num="48" type="stmt" count="15"/>
<line num="50" type="stmt" count="15"/>
<line num="48" type="stmt" count="16"/>
<line num="50" type="stmt" count="16"/>
<metrics loc="51" ncloc="51" classes="1" methods="4" coveredmethods="4" conditionals="0" coveredconditionals="0" statements="12" coveredstatements="12" elements="16" coveredelements="16"/>
</file>
<file name="/srv/raml-json-api/src/helpers/ConfigOptions.php">
Expand Down Expand Up @@ -2770,14 +2770,14 @@
<class name="rjapi\helpers\MigrationsHelper" namespace="rjapi\helpers">
<metrics complexity="3" methods="1" coveredmethods="1" conditionals="0" coveredconditionals="0" statements="7" coveredstatements="7" elements="8" coveredelements="8"/>
</class>
<line num="11" type="method" name="getTableName" visibility="public" complexity="3" crap="3" count="18"/>
<line num="13" type="stmt" count="18"/>
<line num="15" type="stmt" count="18"/>
<line num="16" type="stmt" count="18"/>
<line num="18" type="stmt" count="18"/>
<line num="19" type="stmt" count="18"/>
<line num="21" type="stmt" count="18"/>
<line num="25" type="stmt" count="18"/>
<line num="11" type="method" name="getTableName" visibility="public" complexity="3" crap="3" count="19"/>
<line num="13" type="stmt" count="19"/>
<line num="15" type="stmt" count="19"/>
<line num="16" type="stmt" count="19"/>
<line num="18" type="stmt" count="19"/>
<line num="19" type="stmt" count="19"/>
<line num="21" type="stmt" count="19"/>
<line num="25" type="stmt" count="19"/>
<metrics loc="26" ncloc="24" classes="1" methods="1" coveredmethods="1" conditionals="0" coveredconditionals="0" statements="7" coveredstatements="7" elements="8" coveredelements="8"/>
</file>
<file name="/srv/raml-json-api/src/helpers/SqlOptions.php">
Expand Down Expand Up @@ -2906,6 +2906,6 @@
<file name="/srv/raml-json-api/src/types/RoutesInterface.php">
<metrics loc="14" ncloc="14" classes="0" methods="0" coveredmethods="0" conditionals="0" coveredconditionals="0" statements="0" coveredstatements="0" elements="0" coveredelements="0"/>
</file>
<metrics files="71" loc="6664" ncloc="4990" classes="46" methods="341" coveredmethods="227" conditionals="0" coveredconditionals="0" statements="2178" coveredstatements="1381" elements="2519" coveredelements="1608"/>
<metrics files="71" loc="6664" ncloc="4990" classes="46" methods="341" coveredmethods="227" conditionals="0" coveredconditionals="0" statements="2178" coveredstatements="1389" elements="2519" coveredelements="1616"/>
</project>
</coverage>
15 changes: 15 additions & 0 deletions tests/unit/extension/SpellCheckTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@


use rjapi\extension\SpellCheck;
use rjapi\extension\SpellCheckTrait;
use rjapi\helpers\ConfigHelper;
use rjapi\helpers\MigrationsHelper;
use rjapi\types\ConfigInterface;
Expand All @@ -18,10 +19,13 @@
*/
class SpellCheckTest extends TestCase
{
use SpellCheckTrait;

private const ENTITY = 'article';
private const DESCRIPTION = 'description';

private $spellCheck;
private $entity;

/**
*
Expand All @@ -30,6 +34,7 @@ public function setUp()
{
parent::setUp();
$this->spellCheck = new SpellCheck(self::ENTITY);
$this->entity = 'article';
}

/**
Expand Down Expand Up @@ -64,4 +69,14 @@ public function it_get_field()
$this->spellCheck = new SpellCheck(self::ENTITY);
$this->assertEquals($this->spellCheck->getField(), self::DESCRIPTION);
}

/**
* @test
*/
public function it_checks_spell_via_trait()
{
$this->assertArraySubset([], $this->spellCheck([
'description' => 'Standard text for testing'
]));
}
}

0 comments on commit 69167be

Please sign in to comment.