-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding first test for JoRobo Adding phpstan dependency and configuration
- Loading branch information
Showing
16 changed files
with
835 additions
and
18 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,9 @@ | ||
includes: | ||
- vendor/phpstan/phpstan-deprecation-rules/rules.neon | ||
parameters: | ||
level: 1 | ||
paths: | ||
- src | ||
excludePaths: | ||
ignoreErrors: | ||
reportUnmatchedIgnoredErrors: false |
This file was deleted.
Oops, something went wrong.
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,5 @@ | ||
<?php | ||
if (!defined('JPATH_BASE')) { | ||
define('JPATH_BASE', dirname(__DIR__)); | ||
} | ||
|
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,86 @@ | ||
<?php | ||
|
||
namespace Robo; | ||
|
||
use Symfony\Component\Filesystem\Filesystem; | ||
|
||
class Fixtures | ||
{ | ||
protected $testDir; | ||
protected $tmpDirs = []; | ||
protected $clonedRepos = []; | ||
|
||
/** | ||
* Fixtures constructor | ||
*/ | ||
public function __construct() | ||
{ | ||
$testDir = false; | ||
} | ||
|
||
/** | ||
* Clean up any temporary directories that may have been created | ||
*/ | ||
public function cleanup() | ||
{ | ||
$fs = new Filesystem(); | ||
foreach ($this->tmpDirs as $tmpDir) { | ||
try { | ||
$fs->remove($tmpDir); | ||
} | ||
catch (\Exception $e) { | ||
// Ignore problems with removing fixtures. | ||
} | ||
} | ||
$this->tmpDirs = []; | ||
} | ||
|
||
/** | ||
* Create a new temporary directory. | ||
* | ||
* @param string|bool $basedir Where to store the temporary directory | ||
* @return type | ||
*/ | ||
public function mktmpdir($basedir = false) | ||
{ | ||
$tempfile = tempnam($basedir ?: $this->testDir ?: sys_get_temp_dir(),'robo-tests'); | ||
unlink($tempfile); | ||
mkdir($tempfile); | ||
$this->tmpDirs[] = $tempfile; | ||
return $tempfile; | ||
} | ||
|
||
public function createAndCdToSandbox() | ||
{ | ||
$sourceSandbox = $this->sandboxDir(); | ||
$targetSandbox = $this->mktmpdir(); | ||
$fs = new Filesystem(); | ||
$fs->mirror($sourceSandbox, $targetSandbox); | ||
chdir($targetSandbox); | ||
|
||
return $targetSandbox; | ||
} | ||
|
||
public function dataFile($filename) | ||
{ | ||
return $this->fixturesDir() . '/' . $filename; | ||
} | ||
|
||
protected function fixturesDir() | ||
{ | ||
return dirname(__DIR__) . '/_data'; | ||
} | ||
|
||
protected function sandboxDir() | ||
{ | ||
return $this->fixturesDir() . '/claypit'; | ||
} | ||
|
||
protected function testDir() | ||
{ | ||
if (!$this->testDir) { | ||
$this->testDir = $this->mktmpdir(); | ||
} | ||
return $this->testDir; | ||
} | ||
} |
Oops, something went wrong.