public function testSetParameter()
 {
     $conf = new PropelConfiguration(array());
     $conf->setParameter('foo.fooo', 'bar');
     $conf->setParameter('foo.fi.fooooo', 'bara');
     $conf->setParameter('baz', 'bar2');
     $this->assertEquals($this->testArray, $conf->getParameters(), 'setParameter accepts a flat array');
 }
 /**
  * Creates an array of Build objects.
  *
  * @return array  An array of Build objects
  */
 private function buildQueries()
 {
     $queries = array();
     $outerGlue = $this->propelConfiguration->getParameter('debugpdo.logging.outerglue', ' | ');
     $innerGlue = $this->propelConfiguration->getParameter('debugpdo.logging.innerglue', ': ');
     foreach ($this->logger->getQueries() as $q) {
         $parts = explode($outerGlue, $q);
         $times = explode($innerGlue, $parts[0]);
         $memories = explode($innerGlue, $parts[1]);
         $sql = trim($parts[2]);
         $time = trim($times[1]);
         $memory = trim($memories[1]);
         $queries[] = new Query($sql, $time, $memory);
     }
     return $queries;
 }
 protected function getPropelConfiguration()
 {
     $config = new PropelConfiguration(array());
     $config->setParameter('debugpdo.logging.outerglue', 'xx');
     $config->setParameter('debugpdo.logging.innerglue', '/ ');
     $config->setParameter('debugpdo.logging.details.slow.enabled', true);
     $config->setParameter('debugpdo.logging.details.slow.threshold', 5);
     return $config;
 }
 /**
  * Creates an array of Build objects.
  *
  * @return array An array of Build objects
  */
 private function buildQueries()
 {
     $queries = array();
     $outerGlue = $this->propelConfiguration->getParameter('debugpdo.logging.outerglue', ' | ');
     $innerGlue = $this->propelConfiguration->getParameter('debugpdo.logging.innerglue', ': ');
     foreach ($this->logger->getQueries() as $q) {
         $parts = explode($outerGlue, $q, 4);
         $times = explode($innerGlue, $parts[0]);
         $con = explode($innerGlue, $parts[2]);
         $memories = explode($innerGlue, $parts[1]);
         $sql = trim($parts[3]);
         $con = trim($con[1]);
         $time = trim($times[1]);
         $memory = trim($memories[1]);
         $queries[] = array('connection' => $con, 'sql' => $sql, 'time' => $time, 'memory' => $memory);
     }
     return $queries;
 }
示例#5
0
 public function testGetParameterMultiNamespacedKeyArrayValue()
 {
     $c = new PropelConfiguration();
     $c['a'] = array('b' => array('c' => array('bar1' => 'baz1')));
     $this->assertNull($c->getParameter('a.b.c'));
     $this->assertEquals('baz1', $c->getParameter('a.b.c.bar1'));
 }