Skip to content

Commit

Permalink
Restructuring test location
Browse files Browse the repository at this point in the history
  • Loading branch information
borkweb committed Jul 7, 2023
1 parent 6689b30 commit bea0611
Show file tree
Hide file tree
Showing 16 changed files with 30 additions and 5 deletions.
7 changes: 7 additions & 0 deletions tests/cli/AbstractBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ class AbstractBase {
use \tad\Codeception\SnapshotAssertions\SnapshotAssertions;

protected $pup;
protected $pup_root;
protected $tests_root;

public function __construct() {
$this->tests_root = dirname( __DIR__ );
$this->pup_root = dirname( $this->tests_root );
}

public function _before( CliTester $I ) {
$this->pup = dirname( dirname( __DIR__ ) ) . '/pup';
Expand Down
9 changes: 5 additions & 4 deletions tests/cli/BuildCest.php → tests/cli/Commands/BuildCest.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?php

namespace StellarWP\Pup\Tests\Cli;
namespace StellarWP\Pup\Tests\Cli\Commands;

use StellarWP\Pup\Tests\Cli\AbstractBase;
use StellarWP\Pup\Tests\CliTester;

class BuildCest extends AbstractBase {
Expand All @@ -17,7 +18,7 @@ public function it_should_run_build( CliTester $I ) {
$puprc['build'][] = 'echo "fake project, yo"';
$this->write_puprc( $puprc );

chdir( dirname( __DIR__ ) . '/_data/fake-project' );
chdir( $this->tests_root . '/_data/fake-project' );

$I->runShellCommand( "php {$this->pup} build" );
$I->seeResultCodeIs( 0 );
Expand All @@ -37,7 +38,7 @@ public function it_should_run_no_build_steps_when_not_set_in_puprc( CliTester $I
unset( $puprc['build'] );
$this->write_puprc( $puprc );

chdir( dirname( __DIR__ ) . '/_data/fake-project' );
chdir( $this->tests_root . '/_data/fake-project' );

$I->runShellCommand( "php {$this->pup} build" );
$I->seeResultCodeIs( 0 );
Expand All @@ -54,7 +55,7 @@ public function it_should_run_no_build_steps_when_not_set_in_puprc( CliTester $I
* @test
*/
public function it_should_run_no_build_steps_when_missing_puprc( CliTester $I ) {
chdir( dirname( __DIR__ ) . '/_data/fake-project' );
chdir( $this->tests_root . '/_data/fake-project' );
$I->runShellCommand( "php {$this->pup} build" );
$I->seeResultCodeIs( 0 );
$I->seeInShellOutput( 'Build complete.' );
Expand Down
16 changes: 16 additions & 0 deletions tests/cli/Commands/GetVersionCest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

namespace StellarWP\Pup\Tests\Cli\Commands;

use StellarWP\Pup\Tests\Cli\AbstractBase;
use StellarWP\Pup\Tests\CliTester;

class GetVersionCest extends AbstractBase {

/**
* @test
*/
public function it_should_get_the_version_from_the_plugin( CliTester $I ) {

}
}
3 changes: 2 additions & 1 deletion tests/cli/HelpCest.php → tests/cli/Commands/HelpCest.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php

namespace StellarWP\Pup\Tests\Cli;
namespace StellarWP\Pup\Tests\Cli\Commands;

use Codeception\Example;
use StellarWP\Pup\Tests\Cli\AbstractBase;
use StellarWP\Pup\Tests\CliTester;

class HelpCest extends AbstractBase {
Expand Down

0 comments on commit bea0611

Please sign in to comment.