Example #1
0
 /**
  * Test getting the project-name
  */
 public function testGetName()
 {
     $this->assertEquals(self::PROJECT_NAME, $this->_object->getName());
 }
Example #2
0
 /**
  * Add a project to watch
  *
  * @param  \Testy\Project $oProject
  *
  * @return $this
  */
 public function add(\Testy\Project $oProject)
 {
     $sName = $oProject->getName();
     if (empty($this->_aStack[$sName]) === true or $oProject->getProjectHash() !== $this->_aStack[$sName]->getProjectHash()) {
         if ($oProject->isEnabled() === true) {
             $this->_aStack[$sName] = $oProject;
             $oProject->notify(\notifyy\Notifyable::INFO, \Testy\Project\Builder::INFO);
         } elseif (empty($this->_aStack[$sName]) !== true) {
             unset($this->_aStack[$sName]);
         }
     }
     return $this;
 }
Example #3
0
 /**
  * Enrich the command with placeholders
  *
  * @param  boolean $bSingle
  *
  * @return string
  */
 protected function _getCommand($bSingle = false)
 {
     $sCommand = $this->_sCommand;
     if ($bSingle === true) {
         $oTestMapper = new \Testy\Project\File\Mapper($sCommand, $this->_sFile);
         $sCommand = $oTestMapper->map()->get();
         unset($oTestMapper);
     }
     if (empty($this->_sSyncPath) !== true) {
         $sCommand = str_replace($this->_sSyncPath->from, $this->_sSyncPath->to, $sCommand);
     }
     $sCommand = trim(preg_replace('!{.*?}!i', '', $sCommand));
     if (empty($this->_sChangeDir) !== true) {
         $sCommand = sprintf('cd %s; %s', $this->_sChangeDir, $sCommand);
     }
     if (empty($this->_sSyncPath) !== true) {
         $sCommand = sprintf('rsync -azq %s %s; %s', $this->_sSyncPath->from, $this->_sSyncPath->to, $sCommand);
     }
     $aReplace = array(self::FILE_PLACEHOLDER => '', self::TIME_PLACEHOLDER => time(), self::MTIME_PLACEHOLDER => filemtime($this->_sFile), self::PROJECT_PLACEHOLDER => $this->_oProject->getName());
     return str_replace(array_keys($aReplace), array_values($aReplace), $sCommand);
 }