-
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
1 parent
b53b247
commit 004a444
Showing
9 changed files
with
658 additions
and
9 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
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
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
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
58 changes: 58 additions & 0 deletions
58
tests/Http/Maintenance/Driver/FileMaintenanceDriverTest.php
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,58 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Platine\Test\Framework\Http\Maintenance\Driver; | ||
|
||
use org\bovigo\vfs\vfsStream; | ||
use Platine\Config\Config; | ||
use Platine\Dev\PlatineTestCase; | ||
use Platine\Filesystem\Adapter\Local\LocalAdapter; | ||
use Platine\Filesystem\Filesystem; | ||
use Platine\Framework\Http\Maintenance\Driver\FileMaintenanceDriver; | ||
|
||
/* | ||
* @group core | ||
* @group framework | ||
*/ | ||
class FileMaintenanceDriverTest extends PlatineTestCase | ||
{ | ||
protected $vfsRoot; | ||
protected $vfsPath; | ||
|
||
protected function setUp(): void | ||
{ | ||
parent::setUp(); | ||
//need setup for each test | ||
$this->vfsRoot = vfsStream::setup(); | ||
$this->vfsPath = vfsStream::newDirectory('my_tests')->at($this->vfsRoot); | ||
} | ||
|
||
public function testDefault(): void | ||
{ | ||
$dir = $this->createVfsDirectory('app', $this->vfsRoot); | ||
$localAdapter = new LocalAdapter($dir->url()); | ||
$filesystem = new Filesystem($localAdapter); | ||
|
||
$config = $this->getMockInstanceMap(Config::class, [ | ||
'get' => [ | ||
['maintenance.storages.file.path', '', $dir->url() . '/maintenance'] | ||
] | ||
]); | ||
|
||
$o = new FileMaintenanceDriver($config, $filesystem); | ||
$this->assertFalse($o->active()); | ||
|
||
$o->activate(['foo' => 'bar']); | ||
|
||
$this->assertTrue($o->active()); | ||
|
||
$data = $o->data(); | ||
$this->assertCount(1, $data); | ||
$this->assertArrayHasKey('foo', $data); | ||
$this->assertEquals('bar', $data['foo']); | ||
|
||
$o->deactivate(); | ||
$this->assertFalse($o->active()); | ||
} | ||
} |
Oops, something went wrong.