-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
254 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,6 @@ | |
vendor/ | ||
*.phar | ||
|
||
composer.lock | ||
composer.lock | ||
tests/_output | ||
tests/_support/_generated |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
actor: Tester | ||
namespace: StellarWP\Pup\Tests | ||
paths: | ||
tests: tests | ||
output: tests/_output | ||
data: tests/_data | ||
support: tests/_support | ||
envs: tests/_envs | ||
extensions: | ||
enabled: | ||
- Codeception\Extension\RunFailed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,51 @@ | ||
{ | ||
"name": "stellarwp/pup", | ||
"description": "StellarWP's Project Utilities & Packager", | ||
"authors": [ | ||
{ | ||
"name": "StellarWP", | ||
"email": "dev@stellarwp.com" | ||
} | ||
], | ||
"platform": { | ||
"php": "7.2" | ||
}, | ||
"bin": [ | ||
"pup" | ||
], | ||
"minimum-stability": "dev", | ||
"prefer-stable": true, | ||
"license": "MIT", | ||
"require": { | ||
"composer/composer": "*", | ||
"php": "^7.2|^8.0", | ||
"symfony/process": "^5.4", | ||
"symfony/console": "^5.4", | ||
"symfony/finder": "^5.4", | ||
"symfony/filesystem": "^5.4" | ||
}, | ||
"require-dev": { | ||
"phpstan/phpstan": "^1.10.0" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"StellarWP\\Pup\\": "src/" | ||
} | ||
}, | ||
"scripts": { | ||
"build-phar" : [ | ||
"test -f ./bin/box.phar || curl -o bin/box.phar -L -C - https://github.com/box-project/box/releases/download/3.16.0/box.phar", | ||
"@php bin/box.phar build" | ||
], | ||
"test:analysis": [ | ||
"phpstan analyse -c phpstan.neon.dist --memory-limit=512M" | ||
] | ||
}, | ||
"scripts-descriptions": { | ||
"test:analysis": "Run PHPStan static code analysis" | ||
} | ||
} | ||
{ | ||
"name": "stellarwp/pup", | ||
"description": "StellarWP's Project Utilities & Packager", | ||
"authors": [ | ||
{ | ||
"name": "StellarWP", | ||
"email": "dev@stellarwp.com" | ||
} | ||
], | ||
"platform": { | ||
"php": "7.2" | ||
}, | ||
"bin": [ | ||
"pup" | ||
], | ||
"minimum-stability": "dev", | ||
"prefer-stable": true, | ||
"license": "MIT", | ||
"require": { | ||
"composer/composer": "*", | ||
"php": "^7.2|^8.0", | ||
"symfony/process": "^5.4", | ||
"symfony/console": "^5.4", | ||
"symfony/finder": "^5.4", | ||
"symfony/filesystem": "^5.4" | ||
}, | ||
"require-dev": { | ||
"phpstan/phpstan": "^1.10.0", | ||
"codeception/codeception": "^4.2", | ||
"codeception/module-phpbrowser": "^1.0.0", | ||
"codeception/module-asserts": "^1.0.0", | ||
"codeception/module-cli": "^2.0" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"StellarWP\\Pup\\": "src/" | ||
} | ||
}, | ||
"scripts": { | ||
"build-phar": [ | ||
"test -f ./bin/box.phar || curl -o bin/box.phar -L -C - https://github.com/box-project/box/releases/download/3.16.0/box.phar", | ||
"@php bin/box.phar build" | ||
], | ||
"test:analysis": [ | ||
"phpstan analyse -c phpstan.neon.dist --memory-limit=512M" | ||
] | ||
}, | ||
"scripts-descriptions": { | ||
"test:analysis": "Run PHPStan static code analysis" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,33 @@ | ||
#!/usr/bin/env php | ||
<?php | ||
|
||
namespace StellarWP\Pup; | ||
|
||
const PUP_VERSION = '0.0.3'; | ||
define( '__PUP_DIR__', __DIR__ ); | ||
|
||
call_user_func( function( $version ) { | ||
if ( ! Phar::running() ) { | ||
$local_dir_autoload = __PUP_DIR__ . '/vendor/autoload.php'; | ||
$autoload = getcwd() . '/vendor/autoload.php'; | ||
if ( ! \Phar::running() ) { | ||
$local_dir_autoload = __PUP_DIR__ . '/vendor/autoload.php'; | ||
$autoload = getcwd() . '/vendor/autoload.php'; | ||
|
||
if ( ! empty( $GLOBALS['_composer_autoload_path'] ) ) { | ||
require $GLOBALS['_composer_autoload_path']; | ||
} elseif ( is_file( $local_dir_autoload ) ) { | ||
require $local_dir_autoload; | ||
} elseif ( is_file( $autoload ) ) { | ||
require $autoload; | ||
} else { | ||
fwrite( STDERR, | ||
'You must set up the project dependencies, run the following commands:' . PHP_EOL . | ||
'curl -s http://getcomposer.org/installer | php' . PHP_EOL . | ||
'php composer.phar install' . PHP_EOL | ||
); | ||
exit( 1 ); | ||
} | ||
if ( ! empty( $GLOBALS['_composer_autoload_path'] ) ) { | ||
require $GLOBALS['_composer_autoload_path']; | ||
} elseif ( is_file( $local_dir_autoload ) ) { | ||
require $local_dir_autoload; | ||
} elseif ( is_file( $autoload ) ) { | ||
require $autoload; | ||
} else { | ||
require __PUP_DIR__ . '/vendor/autoload.php'; | ||
fwrite( STDERR, | ||
'You must set up the project dependencies, run the following commands:' . PHP_EOL . | ||
'curl -s http://getcomposer.org/installer | php' . PHP_EOL . | ||
'php composer.phar install' . PHP_EOL | ||
); | ||
exit( 1 ); | ||
} | ||
} else { | ||
require __PUP_DIR__ . '/vendor/autoload.php'; | ||
} | ||
|
||
\StellarWP\Pup\App::getConfig(); | ||
$app = \StellarWP\Pup\App::instance(); | ||
$app->run(); | ||
}, PUP_VERSION ); | ||
App::getConfig(); | ||
$app = App::instance(); | ||
$app->run(); |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
namespace StellarWP\Pup\Tests; | ||
|
||
/** | ||
* Inherited Methods | ||
* @method void wantToTest($text) | ||
* @method void wantTo($text) | ||
* @method void execute($callable) | ||
* @method void expectTo($prediction) | ||
* @method void expect($prediction) | ||
* @method void amGoingTo($argumentation) | ||
* @method void am($role) | ||
* @method void lookForwardTo($achieveValue) | ||
* @method void comment($description) | ||
* @method void pause() | ||
* | ||
* @SuppressWarnings(PHPMD) | ||
*/ | ||
class CliTester extends \Codeception\Actor | ||
{ | ||
use _generated\CliTesterActions; | ||
|
||
/** | ||
* Define custom actions here | ||
*/ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
namespace StellarWP\Pup\Tests\Helper; | ||
|
||
// here you can define custom actions | ||
// all public methods declared in helper class will be available in $I | ||
|
||
class Cli extends \Codeception\Module | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
namespace Helper; | ||
|
||
// here you can define custom actions | ||
// all public methods declared in helper class will be available in $I | ||
|
||
class Unit extends \Codeception\Module | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
|
||
/** | ||
* Inherited Methods | ||
* @method void wantToTest($text) | ||
* @method void wantTo($text) | ||
* @method void execute($callable) | ||
* @method void expectTo($prediction) | ||
* @method void expect($prediction) | ||
* @method void amGoingTo($argumentation) | ||
* @method void am($role) | ||
* @method void lookForwardTo($achieveValue) | ||
* @method void comment($description) | ||
* @method void pause() | ||
* | ||
* @SuppressWarnings(PHPMD) | ||
*/ | ||
class UnitTester extends \Codeception\Actor | ||
{ | ||
use _generated\UnitTesterActions; | ||
|
||
/** | ||
* Define custom actions here | ||
*/ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
actor: CliTester | ||
modules: | ||
enabled: | ||
- Asserts | ||
- Cli | ||
- \StellarWP\Pup\Tests\Helper\Cli |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?php | ||
|
||
namespace StellarWP\Pup\Tests; | ||
|
||
use Codeception\Example; | ||
use StellarWP\Pup\Tests\CliTester; | ||
|
||
class HelpCest { | ||
protected $path_to_pup; | ||
|
||
public function _before( CliTester $I ) { | ||
$this->path_to_pup = dirname( dirname( __DIR__ ) ) . '/pup'; | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function it_should_default_to_help( CliTester $I ) { | ||
$I->runShellCommand( "php {$this->path_to_pup}" ); | ||
$I->seeResultCodeIs( 0 ); | ||
$I->seeInShellOutput( 'A CLI utility' ); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function it_should_run_help( CliTester $I ) { | ||
$I->runShellCommand( "php {$this->path_to_pup} help" ); | ||
$I->seeResultCodeIs( 0 ); | ||
$I->seeInShellOutput( 'A CLI utility' ); | ||
} | ||
|
||
/** | ||
* @test | ||
* @dataProvider topicProvider | ||
*/ | ||
public function it_should_show_build_docs( CliTester $I, Example $example ) { | ||
$I->runShellCommand( "php {$this->path_to_pup} help {$example['topic']}" ); | ||
$I->seeResultCodeIs( 0 ); | ||
$I->seeInShellOutput( 'pup ' . $example['topic'] ); | ||
} | ||
|
||
protected function topicProvider(): array { | ||
return [ | ||
[ 'topic' => 'build' ], | ||
[ 'topic' => 'check' ], | ||
[ 'topic' => 'check:tbd' ], | ||
[ 'topic' => 'check:version-conflict' ], | ||
[ 'topic' => 'help' ], | ||
[ 'topic' => 'get-version' ], | ||
[ 'topic' => 'package' ], | ||
[ 'topic' => 'zip' ], | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Codeception Test Suite Configuration | ||
# | ||
# Suite for unit or integration tests. | ||
|
||
actor: UnitTester | ||
modules: | ||
enabled: | ||
- Asserts | ||
- Cli | ||
- \Helper\Unit | ||
step_decorators: ~ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
namespace StellarWP\Pup\Tests; | ||
|
||
use StellarWP\Pup\App; | ||
|
||
class HelpTest extends \Codeception\Test\Unit { | ||
|
||
protected function _before() { | ||
} | ||
|
||
protected function _after() {} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function it_should_show_help() { | ||
|
||
$this->assertTrue( true ); | ||
} | ||
} |