Skip to content

Commit 7fb6de3

Browse files
committed
Add configuration files for PHP CodeSniffer and PHPUnit
1 parent 06670b6 commit 7fb6de3

2 files changed

Lines changed: 127 additions & 0 deletions

File tree

phpcs.xml.dist

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
<?xml version="1.0"?>
2+
<ruleset name="SunshineCMS">
3+
<description>The coding standard for SunshineCMS (based on PSR2).</description>
4+
5+
<file>.</file>
6+
7+
<exclude-pattern>example.php</exclude-pattern>
8+
9+
<exclude-pattern>*/build/*</exclude-pattern>
10+
<exclude-pattern>*/dist/*</exclude-pattern>
11+
<exclude-pattern>*/vendor/*</exclude-pattern>
12+
13+
<arg name="parallel" value="75" />
14+
<arg name="basepath" value="."/>
15+
<arg name="colors" />
16+
<arg value="p" />
17+
18+
<!-- Include the whole PSR2 standard -->
19+
<rule ref="PSR2" />
20+
21+
<!-- Include some sniffs from other standards that don't conflict with PSR2 -->
22+
<rule ref="Squiz.Arrays.ArrayBracketSpacing" />
23+
<rule ref="Squiz.Arrays.ArrayDeclaration" />
24+
<rule ref="Squiz.Commenting.DocCommentAlignment" />
25+
<rule ref="Squiz.Commenting.VariableComment" />
26+
<rule ref="Squiz.Formatting.OperatorBracket" />
27+
<rule ref="Generic.Arrays.DisallowLongArraySyntax" />
28+
<rule ref="Generic.Formatting.SpaceAfterCast" />
29+
<rule ref="Generic.NamingConventions.ConstructorName" />
30+
<rule ref="Generic.PHP.DeprecatedFunctions" />
31+
<rule ref="Generic.Strings.UnnecessaryStringConcat" />
32+
33+
<!-- Disallow blank line indentation and spaces at the end of line -->
34+
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace">
35+
<properties>
36+
<property name="ignoreBlankLines" value="false" />
37+
</properties>
38+
</rule>
39+
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.StartFile">
40+
<severity>10</severity>
41+
</rule>
42+
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.EndFile">
43+
<severity>10</severity>
44+
</rule>
45+
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.EmptyLines">
46+
<severity>10</severity>
47+
</rule>
48+
49+
<!-- Custom indent rules for arrays -->
50+
<rule ref="Generic.Arrays.DisallowLongArraySyntax" />
51+
<rule ref="Squiz.Arrays.ArrayDeclaration.DoubleArrowNotAligned">
52+
<severity>0</severity>
53+
</rule>
54+
<rule ref="Squiz.Arrays.ArrayDeclaration.KeyNotAligned">
55+
<severity>0</severity>
56+
</rule>
57+
<rule ref="Squiz.Arrays.ArrayDeclaration.ValueNotAligned">
58+
<severity>0</severity>
59+
</rule>
60+
<rule ref="Squiz.Arrays.ArrayDeclaration.CloseBraceNotAligned">
61+
<severity>0</severity>
62+
</rule>
63+
<rule ref="Squiz.Arrays.ArrayDeclaration.CloseBraceNewLine">
64+
<severity>0</severity>
65+
</rule>
66+
67+
<!-- Check var names, but we don't want checks about underscores -->
68+
<rule ref="Squiz.NamingConventions.ValidVariableName" />
69+
<rule ref="Squiz.NamingConventions.ValidVariableName.PublicHasUnderscore">
70+
<severity>0</severity>
71+
</rule>
72+
<rule ref="Squiz.NamingConventions.ValidVariableName.PrivateNoUnderscore">
73+
<severity>0</severity>
74+
</rule>
75+
76+
<!-- Only one argument per line in multi-line function calls -->
77+
<rule ref="PEAR.Functions.FunctionCallSignature">
78+
<properties>
79+
<property name="allowMultipleArguments" value="false" />
80+
</properties>
81+
</rule>
82+
83+
<!-- Ban some functions -->
84+
<rule ref="Generic.PHP.ForbiddenFunctions">
85+
<properties>
86+
<property name="forbiddenFunctions" type="array">
87+
<element key="sizeof" value="count" />
88+
<element key="delete" value="unset" />
89+
<element key="print" value="echo" />
90+
</property>
91+
</properties>
92+
</rule>
93+
</ruleset>

phpunit.xml.dist

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/7.1/phpunit.xsd"
5+
backupGlobals="false"
6+
backupStaticAttributes="false"
7+
bootstrap="vendor/autoload.php"
8+
colors="true"
9+
convertErrorsToExceptions="true"
10+
convertNoticesToExceptions="true"
11+
convertWarningsToExceptions="true"
12+
processIsolation="false"
13+
stopOnFailure="false">
14+
15+
<testsuites>
16+
<testsuite name="tests">
17+
<directory suffix="Test.php">./tests/</directory>
18+
</testsuite>
19+
</testsuites>
20+
21+
<filter>
22+
<whitelist processUncoveredFilesFromWhitelist="false">
23+
<directory suffix=".php">./src/</directory>
24+
</whitelist>
25+
</filter>
26+
27+
<logging>
28+
<log type="coverage-html" target="./build/coverage/" />
29+
<log type="coverage-text" target="./build/coverage.txt" />
30+
<log type="coverage-clover" target="./build/clover.xml" />
31+
<log type="testdox-html" target="./build/testdox.html" />
32+
<log type="testdox-text" target="./build/testdox.txt" />
33+
</logging>
34+
</phpunit>

0 commit comments

Comments
 (0)