File tree Expand file tree Collapse file tree 4 files changed +32
-45
lines changed Expand file tree Collapse file tree 4 files changed +32
-45
lines changed Original file line number Diff line number Diff line change 11<?php
2-
32namespace Pds \Skeleton ;
43
54class Console
65{
76 protected $ commandsWhitelist = [
87 'validate ' => 'Pds\Skeleton\ComplianceValidator ' ,
98 'generate ' => 'Pds\Skeleton\PackageGenerator ' ,
9+ 'test ' => 'Pds\Skeleton\TestRunner ' ,
1010 ];
1111
1212 public function execute ($ args )
@@ -19,7 +19,7 @@ public function execute($args)
1919 if (array_key_exists ($ commandName , $ this ->commandsWhitelist )) {
2020 return $ this ->executeCommand ($ this ->commandsWhitelist [$ commandName ], $ args );
2121 }
22-
22+
2323 $ this ->outputHelp ();
2424 return false ;
2525 }
@@ -38,7 +38,7 @@ protected function outputHelp()
3838 {
3939 echo 'Available commands: ' . PHP_EOL ;
4040 foreach ($ this ->commandsWhitelist as $ key => $ value ) {
41- echo 'pdsskeleton ' . $ key . PHP_EOL ;
41+ echo 'pds-skeleton ' . $ key . PHP_EOL ;
4242 }
4343 }
44- }
44+ }
Original file line number Diff line number Diff line change 1+ <?php
2+ namespace Pds \Skeleton ;
3+
4+ class TestRunner
5+ {
6+ public function execute ()
7+ {
8+ ComplianceValidatorTest::run ();
9+ PackageGeneratorTest::run ();
10+ }
11+ }
Original file line number Diff line number Diff line change 11<?php
2-
3- $ autoloadFiles = [
4- __DIR__ . '/../vendor/autoload.php ' ,
5- __DIR__ . '/../../../autoload.php '
6- ];
7-
8- foreach ($ autoloadFiles as $ autoloadFile ) {
9- if (file_exists ($ autoloadFile )) {
10- require_once $ autoloadFile ;
11- break ;
12- }
13- }
14-
15- use Pds \Skeleton \ComplianceValidator ;
16-
17- $ tester = new ComplianceValidatorTest ();
18- // Test all 4 possible states.
19- $ tester ->testValidate_WithIncorrectBin_ReturnsIncorrectBin ();
20- $ tester ->testValidate_WithoutVendor_ReturnsMissingVendor ();
21-
22- echo "Errors: {$ tester ->numErrors }" . PHP_EOL ;
2+ namespace Pds \Skeleton ;
233
244class ComplianceValidatorTest
255{
266 public $ numErrors = 0 ;
277
8+ public static function run ()
9+ {
10+ $ tester = new ComplianceValidatorTest ();
11+ $ tester ->testValidate_WithIncorrectBin_ReturnsIncorrectBin ();
12+ $ tester ->testValidate_WithoutVendor_ReturnsMissingVendor ();
13+ echo __CLASS__ . " errors: {$ tester ->numErrors }" . PHP_EOL ;
14+ }
15+
2816 public function testValidate_WithIncorrectBin_ReturnsIncorrectBin ()
2917 {
3018 $ paths = [
Original file line number Diff line number Diff line change 11<?php
2-
3- $ autoloadFiles = [
4- __DIR__ . '/../vendor/autoload.php ' ,
5- __DIR__ . '/../../../autoload.php '
6- ];
7-
8- foreach ($ autoloadFiles as $ autoloadFile ) {
9- if (file_exists ($ autoloadFile )) {
10- require_once $ autoloadFile ;
11- break ;
12- }
13- }
14-
15- use Pds \Skeleton \ComplianceValidator ;
16- use Pds \Skeleton \PackageGenerator ;
17-
18- $ tester = new PackageGeneratorTest ();
19- $ tester ->testGenerate_WithMissingBin_ReturnsBin ();
20-
21- echo "Errors: {$ tester ->numErrors }" . PHP_EOL ;
2+ namespace Pds \Skeleton ;
223
234class PackageGeneratorTest
245{
256 public $ numErrors = 0 ;
267
8+ public static function run ()
9+ {
10+ $ tester = new PackageGeneratorTest ();
11+ $ tester ->testGenerate_WithMissingBin_ReturnsBin ();
12+ echo __CLASS__ . " errors: {$ tester ->numErrors }" . PHP_EOL ;
13+ }
14+
2715 public function testGenerate_WithMissingBin_ReturnsBin ()
2816 {
2917 $ validatorResults = [
You can’t perform that action at this time.
0 commit comments