1
0
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:
Awilum
2020-10-18 17:34:37 +03:00
parent e289cbdeb1
commit a5d0481a35

View 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'));
});