for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace GacelaTest\Feature\Framework\ExtendService;
use ArrayObject;
use Gacela\Framework\Bootstrap\GacelaConfig;
use Gacela\Framework\Gacela;
use GacelaTest\Feature\Framework\ExtendService\Module\DependencyProvider;
use PHPUnit\Framework\TestCase;
final class FeatureTest extends TestCase
{
private Module\Facade $facade;
public function setUp(): void
Gacela::bootstrap(__DIR__, static function (GacelaConfig $config): void {
$config->resetInMemoryCache();
$config->extendService(
DependencyProvider::ARRAY_AS_OBJECT,
static function (ArrayObject $arrayObject): void {
$arrayObject->append(3);
}
);
DependencyProvider::ARRAY_FROM_FUNCTION,
$arrayObject->append(4);
});
$this->facade = new Module\Facade();
public function test_extend_service_as_object(): void
self::assertEquals(
new ArrayObject([1, 2, 3]),
$this->facade->getArrayAsObject()
public function test_extend_service_from_function(): void
new ArrayObject([1, 2, 4]),
$this->facade->getArrayFromFunction()