mirror of
https://github.com/flextype/flextype.git
synced 2025-08-08 14:16:46 +02:00
feat(tests): add tests for FlextypeHelper method #477
This commit is contained in:
36
tests/Foundation/Helpers/FlextypHelperTest.php
Normal file
36
tests/Foundation/Helpers/FlextypHelperTest.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Flextype\Foundation\Flextype;
|
||||
use Flextype\Foundation\Entries\Entries;
|
||||
use Atomastic\Strings\Strings;
|
||||
|
||||
beforeEach(function() {
|
||||
filesystem()->directory(PATH['project'] . '/entries')->create();
|
||||
});
|
||||
|
||||
afterEach(function (): void {
|
||||
filesystem()->directory(PATH['project'] . '/entries')->delete();
|
||||
});
|
||||
|
||||
test('test getVersion() method', function () {
|
||||
$this->assertTrue(!Strings::create(flextype()->getVersion())->isEmpty());
|
||||
});
|
||||
|
||||
test('test getInstance() method', function () {
|
||||
$firstCall = flextype();
|
||||
$secondCall = Flextype::getInstance();
|
||||
|
||||
$this->assertInstanceOf(Flextype::class, $firstCall);
|
||||
$this->assertSame($firstCall, $secondCall);
|
||||
});
|
||||
|
||||
test('test container() method', function () {
|
||||
// get container
|
||||
$this->assertInstanceOf(Entries::class, flextype('entries'));
|
||||
|
||||
// set container
|
||||
flextype()->container()['foo'] = 'bar';
|
||||
$this->assertEquals('bar', flextype('foo'));
|
||||
});
|
Reference in New Issue
Block a user