Exemplo n.º 1
0
 /**
  * Test configuration section handling
  */
 public function testSections()
 {
     $testData = array('test.first' => 1, 'test.second' => 2, 'test.secondLevel.first' => 'first', 'test.secondLevel.second' => 'second', 'test2' => 'test');
     $this->config->set($testData);
     $this->assertSame(false, $this->config->get('test*', false), 'Returning invalid wildcard returns the default');
     $result = $this->config->get('test.*');
     $this->assertInternalType('array', $result);
     $this->assertEquals(4, count($result));
     $this->assertArrayHasKey('first', $result);
     $this->assertSame(1, $result['first']);
     $result = $this->config->get('test.*', null, true);
     $this->assertInternalType('array', $result);
     $this->assertEquals(4, count($result));
     $this->assertArrayHasKey('test.first', $result);
     $this->assertSame(1, $result['test.first']);
 }
Exemplo n.º 2
0
 /**
  * Tests if the factory produces an error on trying to create a connection to an invalid backend.
  */
 public function testBadConnectionBackendType()
 {
     $this->setExpectedException('\\YapepBase\\Exception\\DatabaseException', 'Invalid database config');
     $this->config->set(array('resource.database.test2.rw.backendType' => 'invalid'));
     DbFactory::getConnection('test2', DbFactory::TYPE_READ_WRITE);
 }