/** * Test loading a Yaml file */ public function testSupportsWithYamlFile() { $this->yamlLoader->expects($this->once())->method('isFile')->willReturn(true); $this->yamlLoader->expects($this->once())->method('validateExtension')->willReturn(true); $yamlFile = Fixtures::getSampleYamlFile(); $this->assertTrue($this->yamlLoader->supports($yamlFile)); }
public function testLoggersConfigured() { $options = Fixtures::getPhpArrayConfig(); // Mocking the ConfigLoader with the load method $configLoader = $this->getMockBuilder('Cascade\\Config\\ConfigLoader')->disableOriginalConstructor()->setMethods(array('load'))->getMock(); $configLoader->method('load')->willReturn($options); $config = new Config($options, $configLoader); $config->load(); $config->configure(); $this->assertTrue(Registry::hasLogger('my_logger')); }
/** * Test supports with a valid array */ public function testSupports() { $array = Fixtures::getSamplePhpArray(); $this->assertTrue($this->arrayLoader->supports($array)); }
public function testLoad() { $json = Fixtures::getSampleJsonString(); $this->assertEquals(json_decode($json, true), $this->loader->load($json)); }
/** * Test loading config from a valid file */ public function testLoadFileFromString() { $this->assertEquals(trim(Fixtures::getSampleString()), $this->mock->readFrom(Fixtures::getSampleString())); }
public function testFileConfig() { $options = Fixtures::getPhpArrayConfig(); Cascade::fileConfig($options); $this->assertInstanceOf('Cascade\\Config', Cascade::getConfig()); }
/** * Test isJson method with invalid JSON string. * Valid scenario is tested by the method above */ public function testSupportsWithNonJsonString() { $this->jsonLoader->expects($this->once())->method('isFile')->willReturn(false); $someString = Fixtures::getSampleString(); $this->assertFalse($this->jsonLoader->supports($someString)); }