Skip to content

Commit

Permalink
Add test for Generic.Files.OneObjectStructurePerFile sniff
Browse files Browse the repository at this point in the history
  • Loading branch information
srtfisher committed Jul 18, 2024
1 parent ca4cc91 commit 873329b
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"scripts": {
"phpcbf": "phpcbf --standard=Alley-Interactive tests/*Test.php",
"phpcs": "phpcs --standard=Alley-Interactive tests/*Test.php -vsn",
"phpcs:fixtures": "phpcs --standard=Alley-Interactive tests/fixtures",
"phpunit": "phpunit",
"test": [
"@phpcs",
Expand Down
48 changes: 48 additions & 0 deletions tests/fixtures/fail/one-object-structure.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName
/**
* One Object Structure per
*
* @package Alley\WP\Coding_Standards
*/

/**
* Example class.
*/
class AI_Example {
/**
* Example property.
*
* @var string
*/
public $example_property;

/**
* Example method.
*
* @return void
*/
public function example_method() {
echo 'Hello, World!';
}
}

/**
* Example class.
*/
class AI_Another_Example {
/**
* Example property.
*
* @var string
*/
public $example_property;

/**
* Example method.
*
* @return void
*/
public function example_method() {
echo 'Hello, World!';
}
}

0 comments on commit 873329b

Please sign in to comment.