Ejemplo n.º 1
0
 /**
  * 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));
 }
Ejemplo n.º 2
0
 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'));
 }
Ejemplo n.º 3
0
 /**
  * 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()));
 }
Ejemplo n.º 6
0
 public function testFileConfig()
 {
     $options = Fixtures::getPhpArrayConfig();
     Cascade::fileConfig($options);
     $this->assertInstanceOf('Cascade\\Config', Cascade::getConfig());
 }
Ejemplo n.º 7
0
 /**
  * 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));
 }