diff --git a/.gitignore b/.gitignore index 5e049e8..8274598 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,5 @@ nbproject cache.properties build vendor/ -composer.phar - +composer.lock .php_cs.cache diff --git a/src/AppMeta.php b/src/AppMeta.php index 7a08ced..9b38599 100644 --- a/src/AppMeta.php +++ b/src/AppMeta.php @@ -33,8 +33,8 @@ public function __construct($name, $context = 'app', $appDir = null) if (! file_exists($this->logDir) && mkdir($this->logDir) && ! is_writable($this->logDir)) { throw new NotWritableException($this->logDir); } - $isDevelop = strpos($context, 'prod') === false; - if ($isDevelop) { + $isCacheable = is_int(strpos($context, 'prod-')) || is_int(strpos($context, 'stage-')); + if (! $isCacheable) { $this->clearTmpDirectory($this->tmpDir); } } diff --git a/tests/AppMetaTest.php b/tests/AppMetaTest.php index fc649e8..d120bba 100644 --- a/tests/AppMetaTest.php +++ b/tests/AppMetaTest.php @@ -6,6 +6,7 @@ */ namespace BEAR\AppMeta; +use BEAR\AppMeta\Exception\AppNameException; use PHPUnit\Framework\TestCase; class AppMetaTest extends TestCase @@ -56,11 +57,9 @@ public function testAppReflectorResourceList() $this->assertSame($expect, $files); } - /** - * @expectedException \BEAR\AppMeta\Exception\AppNameException - */ public function testInvalidName() { + $this->expectException(AppNameException::class); new AppMeta('Invalid\Invalid'); }