Skip to content

Commit

Permalink
Add empty test and phpstan and psalm
Browse files Browse the repository at this point in the history
  • Loading branch information
ajibarra committed Jun 18, 2021
1 parent 8080fd5 commit 73c7af9
Show file tree
Hide file tree
Showing 3 changed files with 192 additions and 0 deletions.
7 changes: 7 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
parameters:
level: 6
autoload_files:
- tests/bootstrap.php
ignoreErrors:
- '#Method CakeDC\\Auth\\Rbac\\Rules\\AbstractRule::_getTableFromRequest\(\) should return Cake\\ORM\\Table but returns Cake\\Datasource\\RepositoryInterface.#'
services:
130 changes: 130 additions & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
<?xml version="1.0"?>
<psalm
totallyTyped="false"
allowCoercionFromStringToClassConst="true"
allowStringToStandInForClass="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
>
<projectFiles>
<directory name="src" />
<ignoreFiles>
<directory name="vendor"/>
</ignoreFiles>
</projectFiles>

<issueHandlers>
<LessSpecificReturnType errorLevel="info" />

<!-- level 3 issues - slightly lazy code writing, but provably low false-negatives -->

<MissingClosureReturnType errorLevel="info" />
<MissingPropertyType errorLevel="info" />

<PropertyNotSetInConstructor errorLevel="info" />
<MissingConstructor>
</MissingConstructor>
<MissingClosureParamType errorLevel="info" />
<MissingParamType errorLevel="info" />

<RedundantCondition>
<errorLevel type="suppress">
</errorLevel>
</RedundantCondition>

<DocblockTypeContradiction errorLevel="info" />
<RedundantConditionGivenDocblockType errorLevel="info" />

<UnresolvableInclude errorLevel="info" />

<!-- level 4 issues - points to possible deficiencies in logic, higher false-positives -->

<MoreSpecificReturnType errorLevel="info" />
<LessSpecificReturnStatement errorLevel="info" />
<TypeCoercion errorLevel="info" />

<PossiblyInvalidArrayAccess errorLevel="info" />
<PossiblyInvalidArrayOffset errorLevel="info" />
<PossiblyInvalidFunctionCall errorLevel="info" />
<PossiblyInvalidIterator errorLevel="info" />
<PossiblyInvalidMethodCall errorLevel="info" />
<PossiblyInvalidOperand errorLevel="info" />
<PossiblyInvalidPropertyAssignment errorLevel="info" />
<PossiblyNullArgument errorLevel="info" />
<PossiblyNullArrayAccess errorLevel="info" />
<PossiblyNullArrayAssignment errorLevel="info" />
<PossiblyNullArrayOffset errorLevel="info" />
<PossiblyNullOperand errorLevel="info" />
<PossiblyNullPropertyAssignment errorLevel="info" />
<PossiblyNullPropertyAssignmentValue errorLevel="info" />
<PossiblyNullPropertyFetch errorLevel="info" />
<PossiblyNullReference errorLevel="info" />

<!-- level 5 issues - should be avoided at mosts costs... -->

<InvalidScalarArgument errorLevel="info" />
<InvalidOperand errorLevel="info" />
<NoInterfaceProperties errorLevel="info" />
<TypeDoesNotContainType errorLevel="info" />
<TypeDoesNotContainNull errorLevel="info" />
<ImplementedReturnTypeMismatch errorLevel="info" />

<!-- level 6 issues - really bad things -->

<NullableReturnStatement>
<errorLevel type="suppress">
</errorLevel>
</NullableReturnStatement>

<MoreSpecificImplementedParamType errorLevel="info" />
<LessSpecificImplementedReturnType errorLevel="info" />

<!-- level 7 issues - even worse -->
<InvalidArgument errorLevel="info" />

<InvalidPropertyAssignmentValue>
<errorLevel type="suppress">
</errorLevel>
</InvalidPropertyAssignmentValue>

<!-- CakePHP Specific -->
<DeprecatedClass>
<errorLevel type="suppress">
</errorLevel>
</DeprecatedClass>

<PossiblyUndefinedArrayOffset>
</PossiblyUndefinedArrayOffset>

<UndefinedConstant errorLevel="suppress" />

<UndefinedPropertyAssignment>
</UndefinedPropertyAssignment>

<UndefinedPropertyFetch>
</UndefinedPropertyFetch>

<EmptyArrayAccess>
</EmptyArrayAccess>

<LoopInvalidation>
</LoopInvalidation>

<UndefinedClass>
<errorLevel type="suppress">
<referencedClass name="Imagine\Image\Boolean" />
</errorLevel>
</UndefinedClass>

<UndefinedMethod>
</UndefinedMethod>

<NullReference>
</NullReference>

<PossiblyUndefinedMethod>
</PossiblyUndefinedMethod>

</issueHandlers>
</psalm>
55 changes: 55 additions & 0 deletions tests/TestCase/View/Helper/MoneyHelperTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?php
declare(strict_types=1);

namespace CakeDC\Money\Test\TestCase\View\Helper;

use CakeDC\Money\View\Helper\MoneyHelper;
use Cake\TestSuite\TestCase;
use Cake\View\View;

/**
* CakeDC\Money\View\Helper\MoneyHelper Test Case
*/
class MoneyHelperTest extends TestCase
{
/**
* Test subject
*
* @var \CakeDC\Money\View\Helper\MoneyHelper
*/
protected $MoneyHelper;

/**
* setUp method
*
* @return void
*/
public function setUp(): void
{
parent::setUp();
$view = new View();
$this->MoneyHelper = new MoneyHelper($view);
}

/**
* tearDown method
*
* @return void
*/
public function tearDown(): void
{
unset($this->MoneyHelper);

parent::tearDown();
}

/**
* Test currency method
*
* @return void
*/
public function testCurrency(): void
{
$this->markTestIncomplete('Not implemented yet.');
}
}

0 comments on commit 73c7af9

Please sign in to comment.