for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Timegryd\OpcacheResetBundle\Tests\DependencyInjection;
use Symfony\Component\Config\Definition\Processor;
use Timegryd\OpcacheResetBundle\DependencyInjection\Configuration;
class ConfigurationTest extends \PHPUnit\Framework\TestCase
{
protected function setUp()
$this->configuration = new Configuration();
configuration
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
class MyClass { } $x = new MyClass(); $x->foo = true;
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:
class MyClass { public $foo; } $x = new MyClass(); $x->foo = true;
$this->processor = new Processor();
processor
}
/**
* @expectedException Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
*/
public function testEmpty()
$this->processor->processConfiguration($this->configuration, []);
public function testHostRequired()
$this->processor->processConfiguration($this->configuration, [
'timegryd-opcache-reset' => [],
]);
public function testDirRequired()
'timegryd-opcache-reset' => [
'host' => 'example.com',
],
public function testSuccess()
$actual = $this->processor->processConfiguration($this->configuration, [
'timegryd_opcache_reset' => [
'dir' => 'web-dir',
$expected = [
];
$this->assertEquals($expected, $actual);
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: