コード例 #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));
 }
コード例 #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'));
 }
コード例 #3
0
 /**
  * Test supports with a valid array
  */
 public function testSupports()
 {
     $array = Fixtures::getSamplePhpArray();
     $this->assertTrue($this->arrayLoader->supports($array));
 }
コード例 #4
0
 public function testLoad()
 {
     $json = Fixtures::getSampleJsonString();
     $this->assertEquals(json_decode($json, true), $this->loader->load($json));
 }
コード例 #5
0
 /**
  * Test loading config from a valid file
  */
 public function testLoadFileFromString()
 {
     $this->assertEquals(trim(Fixtures::getSampleString()), $this->mock->readFrom(Fixtures::getSampleString()));
 }
コード例 #6
0
 public function testFileConfig()
 {
     $options = Fixtures::getPhpArrayConfig();
     Cascade::fileConfig($options);
     $this->assertInstanceOf('Cascade\\Config', Cascade::getConfig());
 }
コード例 #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));
 }