Ocramius /
ProxyManager
This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | namespace ProxyManagerTest; |
||
| 6 | |||
| 7 | use PHPUnit\Framework\TestCase; |
||
| 8 | use ProxyManager\Autoloader\AutoloaderInterface; |
||
| 9 | use ProxyManager\Configuration; |
||
| 10 | use ProxyManager\GeneratorStrategy\EvaluatingGeneratorStrategy; |
||
| 11 | use ProxyManager\GeneratorStrategy\GeneratorStrategyInterface; |
||
| 12 | use ProxyManager\Inflector\ClassNameInflectorInterface; |
||
| 13 | use ProxyManager\Signature\ClassSignatureGeneratorInterface; |
||
| 14 | use ProxyManager\Signature\SignatureCheckerInterface; |
||
| 15 | use ProxyManager\Signature\SignatureGeneratorInterface; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * Tests for {@see \ProxyManager\Configuration} |
||
| 19 | * |
||
| 20 | * @group Coverage |
||
| 21 | */ |
||
| 22 | final class ConfigurationTest extends TestCase |
||
| 23 | { |
||
| 24 | private Configuration $configuration; |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 25 | |||
| 26 | /** |
||
| 27 | * {@inheritDoc} |
||
| 28 | */ |
||
| 29 | protected function setUp() : void |
||
| 30 | { |
||
| 31 | $this->configuration = new Configuration(); |
||
| 32 | } |
||
| 33 | |||
| 34 | /** |
||
| 35 | * @covers \ProxyManager\Configuration::getProxiesNamespace |
||
| 36 | * @covers \ProxyManager\Configuration::setProxiesNamespace |
||
| 37 | */ |
||
| 38 | public function testGetSetProxiesNamespace() : void |
||
| 39 | { |
||
| 40 | self::assertSame( |
||
| 41 | 'ProxyManagerGeneratedProxy', |
||
| 42 | $this->configuration->getProxiesNamespace(), |
||
| 43 | 'Default setting check for BC' |
||
| 44 | ); |
||
| 45 | |||
| 46 | $this->configuration->setProxiesNamespace('foo'); |
||
| 47 | self::assertSame('foo', $this->configuration->getProxiesNamespace()); |
||
| 48 | } |
||
| 49 | |||
| 50 | /** |
||
| 51 | * @covers \ProxyManager\Configuration::getClassNameInflector |
||
| 52 | * @covers \ProxyManager\Configuration::setClassNameInflector |
||
| 53 | */ |
||
| 54 | public function testSetGetClassNameInflector() : void |
||
| 55 | { |
||
| 56 | /** @noinspection UnnecessaryAssertionInspection */ |
||
| 57 | self::assertInstanceOf(ClassNameInflectorInterface::class, $this->configuration->getClassNameInflector()); |
||
| 58 | |||
| 59 | $inflector = $this->createMock(ClassNameInflectorInterface::class); |
||
| 60 | |||
| 61 | $this->configuration->setClassNameInflector($inflector); |
||
| 62 | self::assertSame($inflector, $this->configuration->getClassNameInflector()); |
||
| 63 | } |
||
| 64 | |||
| 65 | /** |
||
| 66 | * @covers \ProxyManager\Configuration::getGeneratorStrategy |
||
| 67 | */ |
||
| 68 | public function testDefaultGeneratorStrategyNeedToBeAInstanceOfEvaluatingGeneratorStrategy() : void |
||
| 69 | { |
||
| 70 | self::assertInstanceOf(EvaluatingGeneratorStrategy::class, $this->configuration->getGeneratorStrategy()); |
||
| 71 | } |
||
| 72 | |||
| 73 | /** |
||
| 74 | * @covers \ProxyManager\Configuration::getGeneratorStrategy |
||
| 75 | * @covers \ProxyManager\Configuration::setGeneratorStrategy |
||
| 76 | */ |
||
| 77 | public function testSetGetGeneratorStrategy() : void |
||
| 78 | { |
||
| 79 | /** @noinspection UnnecessaryAssertionInspection */ |
||
| 80 | self::assertInstanceOf(GeneratorStrategyInterface::class, $this->configuration->getGeneratorStrategy()); |
||
| 81 | |||
| 82 | $strategy = $this->createMock(GeneratorStrategyInterface::class); |
||
| 83 | |||
| 84 | $this->configuration->setGeneratorStrategy($strategy); |
||
| 85 | self::assertSame($strategy, $this->configuration->getGeneratorStrategy()); |
||
| 86 | } |
||
| 87 | |||
| 88 | /** |
||
| 89 | * @covers \ProxyManager\Configuration::getProxiesTargetDir |
||
| 90 | * @covers \ProxyManager\Configuration::setProxiesTargetDir |
||
| 91 | */ |
||
| 92 | public function testSetGetProxiesTargetDir() : void |
||
| 93 | { |
||
| 94 | self::assertDirectoryExists($this->configuration->getProxiesTargetDir()); |
||
| 95 | |||
| 96 | $this->configuration->setProxiesTargetDir(__DIR__); |
||
| 97 | self::assertSame(__DIR__, $this->configuration->getProxiesTargetDir()); |
||
| 98 | } |
||
| 99 | |||
| 100 | /** |
||
| 101 | * @covers \ProxyManager\Configuration::getProxyAutoloader |
||
| 102 | * @covers \ProxyManager\Configuration::setProxyAutoloader |
||
| 103 | */ |
||
| 104 | public function testSetGetProxyAutoloader() : void |
||
| 105 | { |
||
| 106 | /** @noinspection UnnecessaryAssertionInspection */ |
||
| 107 | self::assertInstanceOf(AutoloaderInterface::class, $this->configuration->getProxyAutoloader()); |
||
| 108 | |||
| 109 | $autoloader = $this->createMock(AutoloaderInterface::class); |
||
| 110 | |||
| 111 | $this->configuration->setProxyAutoloader($autoloader); |
||
| 112 | self::assertSame($autoloader, $this->configuration->getProxyAutoloader()); |
||
| 113 | } |
||
| 114 | |||
| 115 | /** |
||
| 116 | * @covers \ProxyManager\Configuration::getSignatureGenerator |
||
| 117 | * @covers \ProxyManager\Configuration::setSignatureGenerator |
||
| 118 | */ |
||
| 119 | public function testSetGetSignatureGenerator() : void |
||
| 120 | { |
||
| 121 | /** @noinspection UnnecessaryAssertionInspection */ |
||
| 122 | self::assertInstanceOf(SignatureCheckerInterface::class, $this->configuration->getSignatureChecker()); |
||
| 123 | |||
| 124 | $signatureGenerator = $this->createMock(SignatureGeneratorInterface::class); |
||
| 125 | |||
| 126 | $this->configuration->setSignatureGenerator($signatureGenerator); |
||
| 127 | self::assertSame($signatureGenerator, $this->configuration->getSignatureGenerator()); |
||
| 128 | } |
||
| 129 | |||
| 130 | /** |
||
| 131 | * @covers \ProxyManager\Configuration::getSignatureChecker |
||
| 132 | * @covers \ProxyManager\Configuration::setSignatureChecker |
||
| 133 | */ |
||
| 134 | public function testSetGetSignatureChecker() : void |
||
| 135 | { |
||
| 136 | /** @noinspection UnnecessaryAssertionInspection */ |
||
| 137 | self::assertInstanceOf(SignatureCheckerInterface::class, $this->configuration->getSignatureChecker()); |
||
| 138 | |||
| 139 | $signatureChecker = $this->createMock(SignatureCheckerInterface::class); |
||
| 140 | |||
| 141 | $this->configuration->setSignatureChecker($signatureChecker); |
||
| 142 | self::assertSame($signatureChecker, $this->configuration->getSignatureChecker()); |
||
| 143 | } |
||
| 144 | |||
| 145 | /** |
||
| 146 | * @covers \ProxyManager\Configuration::getClassSignatureGenerator |
||
| 147 | * @covers \ProxyManager\Configuration::setClassSignatureGenerator |
||
| 148 | */ |
||
| 149 | public function testSetGetClassSignatureGenerator() : void |
||
| 150 | { |
||
| 151 | /** @noinspection UnnecessaryAssertionInspection */ |
||
| 152 | self::assertInstanceOf( |
||
| 153 | ClassSignatureGeneratorInterface::class, |
||
| 154 | $this->configuration->getClassSignatureGenerator() |
||
| 155 | ); |
||
| 156 | $classSignatureGenerator = $this->createMock(ClassSignatureGeneratorInterface::class); |
||
| 157 | |||
| 158 | $this->configuration->setClassSignatureGenerator($classSignatureGenerator); |
||
| 159 | self::assertSame($classSignatureGenerator, $this->configuration->getClassSignatureGenerator()); |
||
| 160 | } |
||
| 161 | } |
||
| 162 |