/** * Wrapper for parent funciton. Switches on and off livepub publishing. * * @param array $urls Relative URLs * @return array Result, keyed by URL. Keys: * - "statuscode": The HTTP status code * - "redirect": A redirect location (if applicable) * - "path": The filesystem path where the cache has been written */ public function publishPages($urls) { LivePubHelper::init_pub(); $r = $this->realPublishPages($urls); LivePubHelper::stop_pub(); return $r; }
/** * check silverstripe db stub */ public function testRequireSilverstripeDB() { LivePubHelper::$init_code = array(); // check that nothing happens when not publishing LivePubHelper::require_silverstripe_db(); $this->assertEquals(count(LivePubHelper::$init_code), 0); // check that it does happen when publishing LivePubHelper::init_pub(); LivePubHelper::require_silverstripe_db(); $this->assertEquals(count(LivePubHelper::$init_code), 1); $this->assertEquals(preg_match('/\\$databaseConfig = array \\(.+\\);/ms', LivePubHelper::$init_code[0]), 1); // check that it's not included twice LivePubHelper::require_silverstripe_db(); $this->assertEquals(count(LivePubHelper::$init_code), 1); LivePubHelper::stop_pub(); }