/** * @covers \StrictPhp\StrictPhpKernel::configureAop */ public function testIfAspectsWasRegisteredProperly() { $strictPhp = StrictPhpKernel::getInstance(); $strictPhp->init(['cacheDir' => realpath(__DIR__ . '/..') . '/integration-tests-go-cache/', 'includePaths' => [__DIR__]]); $container = $strictPhp->getContainer(); $this->assertInstanceOf(PropertyWriteAspect::class, $container->getAspect(PropertyWriteAspect::class)); $this->assertInstanceOf(PostConstructAspect::class, $container->getAspect(PostConstructAspect::class)); }
<?php require __DIR__ . '/../../vendor/autoload.php'; ini_set('display_errors', 1); ini_set('error_reporting', E_ALL); \StrictPhp\StrictPhpKernel::getInstance()->init(['debug' => true, 'cacheDir' => realpath(__DIR__ . '/..') . '/integration-tests-go-cache/', 'includePaths' => [realpath(__DIR__ . '/../StrictPhpTestAsset')]]);
/** * @param string[] $enabled * * @return AspectContainer */ private function buildContainer(array $enabled = null) { if (is_array($enabled)) { $strictPhp = StrictPhpKernel::bootstrap($this->baseConfig, $enabled); } else { $strictPhp = StrictPhpKernel::bootstrap($this->baseConfig); } $container = $strictPhp->getContainer(); $this->assertInstanceOf(AspectContainer::class, $container); $this->assertArraySubset($this->baseConfig, $strictPhp->getOptions()); return $container; }
<?php use StrictPhp\StrictPhpKernel; require __DIR__ . '/../../vendor/autoload.php'; ini_set('display_errors', 1); ini_set('error_reporting', E_ALL); StrictPhpKernel::bootstrap(['debug' => true, 'cacheDir' => realpath(__DIR__ . '/..') . '/integration-tests-go-cache/', 'includePaths' => [realpath(__DIR__ . '/../StrictPhpTestAsset')]], [StrictPhpKernel::CHECK_STATE_AFTER_CONSTRUCTOR_CALL, StrictPhpKernel::JAIL_PUBLIC_METHOD_PARAMETERS, StrictPhpKernel::CHECK_STATE_AFTER_PUBLIC_METHOD_CALL, StrictPhpKernel::CHECK_PUBLIC_METHOD_PARAMETER_TYPE, StrictPhpKernel::CHECK_PUBLIC_METHOD_RETURN_TYPE, StrictPhpKernel::CHECK_PROPERTY_WRITE_IMMUTABILITY, StrictPhpKernel::CHECK_PROPERTY_WRITE_TYPE]);