/** * Load configuration from yaml file. * * @param string * @return array */ private function loadFromConfig($path) { if (!is_file($path)) { throw new \Exception("Unable to open file {$path}"); } $config = Yaml::parse($path); $this->setCodes(CodesBuilder::buildCodes($config)); }
public function testBuildCodesGeneratesACodesInstanceWithProvidedArgs() { $config = array('offset' => 100, 'limit' => 2000, 'coder' => array('secret_key' => 'secret-key')); $codes = CodesBuilder::buildCodes($config); $this->assertInstanceOf('\\SanchoBBDO\\Codes\\Codes', $codes); $this->assertEquals($config['offset'], $codes->getOffset()); $this->assertEquals($config['limit'], $codes->getLimit()); $this->assertEquals($config['coder']['secret_key'], $codes->getCoder()->getSecretKey()); }
public static function createCodes() { $config = Yaml::parse(dirname(__DIR__) . '/Codes/Fixture/config.yaml'); $codes = CodesBuilder::buildCodes($config); return $codes; }