File tree Expand file tree Collapse file tree 7 files changed +146
-0
lines changed Expand file tree Collapse file tree 7 files changed +146
-0
lines changed Original file line number Diff line number Diff line change 1+ # Exclude non-essential files from dist
2+ .github export-ignore
3+ tests export-ignore
4+ index.html export-ignore
5+ phpmd.xml.dist export-ignore
6+ phpunit.xml.dist export-ignore
Original file line number Diff line number Diff line change 1+ .idea
2+
3+ /vendor /
4+ composer.lock
5+
6+ .phpunit.result.cache
7+
8+ .docker
9+ Dockerfile
10+ docker-compose.yaml
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Devgine \Demo \Command ;
4+
5+ use Symfony \Component \Console \Attribute \AsCommand ;
6+ use Symfony \Component \Console \Command \Command ;
7+ use Symfony \Component \Console \Input \InputInterface ;
8+ use Symfony \Component \Console \Output \OutputInterface ;
9+
10+ #[AsCommand(
11+ name: 'devgine:demo:hello ' ,
12+ description: 'Hello command '
13+ )]
14+ class HelloCommand extends Command
15+ {
16+ /** @SuppressWarnings(PHPMD.UnusedFormalParameter) */
17+ protected function execute (InputInterface $ input , OutputInterface $ output ): int
18+ {
19+ $ output ->writeln ('<info>Devgine demo is installed.</info> ' );
20+
21+ return Command::SUCCESS ;
22+ }
23+ }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Devgine \Demo \Tests \Command ;
4+
5+ use Devgine \Demo \Command \HelloCommand ;
6+ use PHPUnit \Framework \TestCase ;
7+ use Symfony \Component \Console \Application ;
8+ use Symfony \Component \Console \Tester \CommandTester ;
9+
10+ class HelloCommandTest extends TestCase
11+ {
12+ public function testExecute ()
13+ {
14+ $ application = new Application ();
15+ $ application ->add (new HelloCommand ());
16+ $ command = $ application ->find ('devgine:demo:hello ' );
17+ $ commandTester = new CommandTester ($ command );
18+
19+ $ code = $ commandTester ->execute ([]);
20+
21+ $ this ->assertEquals (0 , $ code );
22+ $ this ->assertStringContainsString ('Devgine demo is installed. ' , $ commandTester ->getDisplay ());
23+ }
24+ }
Original file line number Diff line number Diff line change 1+ {
2+ "name" : " devgine/demo" ,
3+ "description" : " demo project" ,
4+ "type" : " library" ,
5+ "keywords" : [" demo" ],
6+ "homepage" : " https://github.com/devgine/demo-repository" ,
7+ "require" : {
8+ "php" : " >=8.1" ,
9+ "symfony/console" : " ^6.1"
10+ },
11+ "license" : " MIT" ,
12+ "autoload" : {
13+ "psr-4" : {
14+ "Devgine\\ Demo\\ " : " "
15+ },
16+ "exclude-from-classmap" : [
17+ " /Tests/"
18+ ]
19+ },
20+ "authors" : [
21+ {
22+ "name" : " Yosri BAHRI" ,
23+ "email" : " yosribahri@gmail.com"
24+ }
25+ ],
26+ "minimum-stability" : " dev"
27+ }
Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" ?>
2+ <ruleset name =" Devgine demo PHPMD rule set"
3+ xmlns =" http://pmd.sf.net/ruleset/1.0.0"
4+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
5+ xsi : schemaLocation =" http://pmd.sf.net/ruleset/1.0.0
6+ http://pmd.sf.net/ruleset_xml_schema.xsd"
7+ xsi : noNamespaceSchemaLocation ="
8+ http://pmd.sf.net/ruleset_xml_schema.xsd" >
9+ <description >Devgine demo rules</description >
10+
11+ <rule ref =" rulesets/cleancode.xml" >
12+ <exclude name =" StaticAccess" />
13+ </rule >
14+ <rule ref =" rulesets/codesize.xml" />
15+ <rule ref =" rulesets/codesize.xml/CyclomaticComplexity" >
16+ <priority >1</priority >
17+ <properties >
18+ <property name =" reportLevel" value =" 7" />
19+ </properties >
20+ </rule >
21+ <rule ref =" rulesets/naming.xml" >
22+ <exclude name =" ShortVariable" />
23+ </rule >
24+ <rule ref =" rulesets/design.xml" />
25+ <rule ref =" rulesets/controversial.xml" />
26+ <rule ref =" rulesets/unusedcode.xml" />
27+
28+ <exclude-pattern >**/vendor/**</exclude-pattern >
29+ </ruleset >
Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2+
3+ <!-- https://phpunit.readthedocs.io/en/latest/configuration.html -->
4+ <phpunit xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
5+ xsi : noNamespaceSchemaLocation =" vendor/phpunit/phpunit/phpunit.xsd"
6+ backupGlobals =" false"
7+ colors =" true"
8+ bootstrap =" vendor/autoload.php"
9+ convertDeprecationsToExceptions =" false"
10+ >
11+ <php >
12+ <ini name =" display_errors" value =" 1" />
13+ <ini name =" error_reporting" value =" -1" />
14+ </php >
15+
16+ <testsuites >
17+ <testsuite name =" Unit test suite" >
18+ <directory >./tests</directory >
19+ </testsuite >
20+ </testsuites >
21+
22+ <coverage processUncoveredFiles =" true" >
23+ <include >
24+ <directory suffix =" .php" >src</directory >
25+ </include >
26+ </coverage >
27+ </phpunit >
You can’t perform that action at this time.
0 commit comments