compared with
This line was removed.
This word was removed. This word was added.
This line was added.

Changes (2)

View Page History
h1. Appendix: Automatted tests

Actually we are writing automatted tests for Zend Framework. All tests are in sum a defined coding standard for Zend Framework using PHP_CodeSniffer and will be delivered with Zend Framework in the future. What has been done until now can be found in the trunk -> incubator -> tools -> codingstandard.

These tests are called "Sniffs" and include the following:

h2. Classes Sniffs
* *ClassFileNameSniff:* Tests that the file name and the name of the class contained within the file match
* *LowercaseClassKeywordsSniff:* Ensures all class keywords are lowercase

h2. Commenting Sniffs
* *InlineCommentSniff:* Checks that no perl-style comments (#)are used

h2. Controlstructure Sniffs
* *ElseIfDeclarationSniff:* Verifies that there are not elseif statements. The else and the if should be separated by a space
* *ForLoopDeclarationSniff:* Verifies that there is a space between each condition of for loops
* *ForEachLoopDeclarationSniff:* Verifies that there is a space between each condition of foreach loops
* *LowercaseDeclarationSniff:* Ensures all control structure keywords are lowercase
* *SwitchDeclarationSniff:* Ensures all the breaks and cases are aligned correctly according to their parent switch's alignment and enforces other switch formatting

h2. File Sniffs
* *ClosingTagSniff:* Checks that the file does not include a closing tag wether at file end nor inline for output purposes
* *LineLengthSniff:* Checks all lines in the file, and throws warnings if they are over 80 characters in length and errors if they are over 120
* *LineEndingsSniff:* Checks for Unix (\n) linetermination, disallowing Windows (\r\n) or Max (\r)

h2. Formatting Sniffs
* *MultipleStatementAlignSniff:* Checks alignment of assignments. If there are multiple adjacent assignments, it will check that the equals signs of each assignment are aligned. It will display a warning to advise that the signs should be aligned

h2. Function Sniffs
* *GlobalFunctionSniff:* Tests for functions outside of classes
* *LowercaseKeywordsSniff:* Ensures all class keywords are lowercase
* *OpeningFunctionBraceSniff:* Checks that the opening brace of a function is on the line after the function declaration

h2. Naming Conventions Sniffs
* *LowerCaseConstantSniff:* Checks that all uses of 'true', 'false' and 'null' are lowercase
* *UpperCaseConstantNameSniff:* Ensures that constant names are all uppercase
* *ValidClassNameSniff:* Ensures class and interface names start with a capital letter and use _ separators

h2. Operator Sniffs
* *IncrementDecrementUsageSniff:* Tests that the ++ operators are used when possible

h2. PHP Sniffs
* *DisallowObEndFlushSniff:* Disallow ob_end_flush, use ob_get_contents() and ob_end_clean() instead
* *DisallowShortOpenTagSniff:* Makes sure that shorthand PHP open tags are not used ("<?"), but allows open tag with echo ("<?="). short_open_tag must be set to true for this test to work
* *ForbiddenFunctionsSniff:* Discourages the use of alias functions that are kept in PHP for compatibility with older versions. Can be used to forbid the use of any function
* *GlobalKeywordSniff:* Stops the usage of the "global" keyword
* *NonExecutableCodeSniff:* Warns about code that can never been executed. This happens when a function returns before the code, or a break ends execution of a statement etc

h2. String Sniffs
* *EchoedStringsSniff:* Makes sure that any strings that are "echoed" are not enclosed in brackets like a function call

h2. Whitespace Sniffs
* *DisallowTabSniff:* Checks if tabs are used and errors if any are found
* *LanguageConstructSpacingSniff:* Ensures all language constructs (without brackets) contain a single space between themselves and their content
* *SemicolonSpacingSniff:* Ensure there is no whitespace before a semicolon

Feel free to mention tests that should be added...