public function setUp()
 {
     $this->setupFile = dirname(__FILE__) . '/../VideoPageTool.setup.php';
     parent::setUp();
     $mock_user = $this->getMock('User', ['getId', 'getName']);
     $mock_user->expects($this->any())->method('getId')->will($this->returnValue(123));
     $mock_user->expects($this->any())->method('getName')->will($this->returnValue('Garthwebb'));
     $this->mockGlobalVariable('wgUser', $mock_user);
     $this->mockStaticMethod('User', 'newFromId', $mock_user);
     /*
      * That's pretty bad, as we will return master db connection for all wfGetDB calls, even those for slave and
      * dataware. But as for now mockGlobalFunction does not support PHPUnit's callbacks and returnValueArray
      */
     $slaveDb = wfGetDB(DB_MASTER, [], 'video151');
     $this->mockGlobalFunction('wfGetDB', $slaveDb);
     $language = 'en';
     $date = 158486400;
     // This is Jan 9th, 1975 a date suitably far in the past but doing well for its age thank you very much
     $this->program = VideoPageToolProgram::newProgram($language, $date);
     // If a previous test faield and didn't clean itself up, clean up now.  This includes
     // deleting related assets and clearing their caches
     if ($this->program->exists()) {
         $cascade = true;
         $this->program->delete($cascade);
         $this->program = VideoPageToolProgram::newProgram($language, $date);
     }
     if (empty($this->program)) {
         throw new Exception("Failed to load program with lang={$language} and date={$date}");
     }
     // Save this program to get a program ID
     $status = $this->program->save();
     if (!$status->isGood()) {
         throw new Exception("Failed to save program with lang={$language} and date={$date}");
     }
     $this->programID = $this->program->getProgramId();
 }