Alfonso Alba García avatar Alfonso Alba García committed 9c512d6

Refactoring: changing names chosen for BackupStrategy classes to show that they are meant to be used for domain level backups.

Comments (0)

Files changed (6)

src/AAlba/PleskBackup/BackupStrategy/BackupStrategyAbstract.php

-<?php
-/**
- * This file is part of Cursosf2Application.
- *
- * Cursosf2Application is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Cursosf2Application is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Cursosf2Application.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-namespace AAlba\PleskBackup\BackupStrategy
-{
-abstract class BackupStrategyAbstract
-{
-    /**
-     * @var \AAlba\PleskBackup\DomainList
-     */
-    private
-        $_domainlist;
-    abstract public function execute();
-
-    /**
-     * @return null
-     */
-    public function setDomainList()
-    {
-        $this->_domainlist;
-    }
-
-    /**
-     *@return \AAlba\PleskBackup\DomainList
-     */
-    public function getDomainList()
-    {
-        return $this->_domainlist;
-    }
-}
-}

src/AAlba/PleskBackup/BackupStrategy/DomainStrategyAbstract.php

+<?php
+/**
+ * This file is part of Cursosf2Application.
+ *
+ * Cursosf2Application is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Cursosf2Application is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Cursosf2Application.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+namespace AAlba\PleskBackup\BackupStrategy
+{
+abstract class DomainStrategyAbstract
+{
+    /**
+     * @var \AAlba\PleskBackup\DomainList
+     */
+    private
+        $_domainlist;
+    abstract public function execute();
+
+    /**
+     * @return null
+     */
+    public function setDomainList()
+    {
+        $this->_domainlist;
+    }
+
+    /**
+     *@return \AAlba\PleskBackup\DomainList
+     */
+    public function getDomainList()
+    {
+        return $this->_domainlist;
+    }
+}
+}

src/AAlba/PleskBackup/BackupStrategy/PleskDomainStandardStrategy.php

+<?php
+/**
+ * This file is part of pleskbackup.
+ *
+ * pleskbackup is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * pleskbackup is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with pleskbackup.  If not, see <http://www.gnu.org/licenses/>.
+ */
+namespace AAlba\PleskBackup\BackupStrategy
+{
+
+/**
+ * Implements the standard Plesk backup command.
+ */
+class PleskDomainStandardStrategy extends DomainStrategyAbstract
+{
+    /**
+     * @var string
+     */
+    private
+        $_host,
+        $_username,
+        $_password,
+        $_path;
+
+    public function execute()
+    {
+        // TODO: Implement execute() method.
+    }
+
+    /**
+     * Gets the FTP host receiving the backups
+     *
+     * @return string
+     */
+    public function getHost()
+    {
+        return $this->_host;
+    }
+
+    /**
+     * Sets the FTP host receiving the backups
+     *
+     * @param string $host
+     * @return void
+     */
+    public function setHost($host)
+    {
+        $this->_host = $host;
+    }
+
+    /**
+     * Sets the username to use to connect to the FTP server
+     *
+     * @param string $username
+     * @return void
+     */
+    public function setUsername($username)
+    {
+        $this->_username = $username;
+    }
+
+    /**
+     * Returns the username to use to connect to the FTP server
+     *
+     * @return string
+     */
+    public function getUsername()
+    {
+        return $this->_username;
+    }
+
+    /**
+     * Sets the password to use to connect to the FTP server
+     *
+     * @param $password
+     * @return void
+     */
+    public function setPassword($password)
+    {
+        $this->_password = $password;
+    }
+
+    /**
+     * Returns the password to use to connect to the FTP server
+     *
+     * @return string
+     */
+    public function getPassword()
+    {
+        return $this->_password;
+    }
+
+    /**
+     * Sets the path in the FTP server of the backup file
+     *
+     * @param $path
+     * @return void
+     */
+    public function setPath($path)
+    {
+        $this->_path = $path;
+    }
+
+    /**
+     * Gets the path in the FTP server of the backup file
+     *
+     * @return string
+     */
+    public function getPath()
+    {
+        return $this->_path;
+    }
+
+
+    /**
+     * Sets the host, username, password and file path to save the backup in an FTP server.
+     *
+     * @param array $arguments
+     */
+    public function setArguments(array $arguments)
+    {
+        $this->_host = isset($arguments['host'])?$arguments['host']:'';
+        $this->_username = isset($arguments['username'])?$arguments['username']:'';
+        $this->_password = isset($arguments['password'])?$arguments['password']:'';
+        $this->_path = isset($arguments['path'])?$arguments['path']:'';
+    }
+}
+}

src/AAlba/PleskBackup/BackupStrategy/PleskStandardStrategy.php

-<?php
-/**
- * This file is part of pleskbackup.
- *
- * pleskbackup is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * pleskbackup is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with pleskbackup.  If not, see <http://www.gnu.org/licenses/>.
- */
-namespace AAlba\PleskBackup\BackupStrategy
-{
-
-/**
- * Implements the standard Plesk backup command.
- */
-class PleskStandardStrategy extends BackupStrategyAbstract
-{
-    /**
-     * @var string
-     */
-    private
-        $_host,
-        $_username,
-        $_password,
-        $_path;
-
-    public function execute()
-    {
-        // TODO: Implement execute() method.
-    }
-
-    /**
-     * Gets the FTP host receiving the backups
-     *
-     * @return string
-     */
-    public function getHost()
-    {
-        return $this->_host;
-    }
-
-    /**
-     * Sets the FTP host receiving the backups
-     *
-     * @param string $host
-     * @return void
-     */
-    public function setHost($host)
-    {
-        $this->_host = $host;
-    }
-
-    /**
-     * Sets the username to use to connect to the FTP server
-     *
-     * @param string $username
-     * @return void
-     */
-    public function setUsername($username)
-    {
-        $this->_username = $username;
-    }
-
-    /**
-     * Returns the username to use to connect to the FTP server
-     *
-     * @return string
-     */
-    public function getUsername()
-    {
-        return $this->_username;
-    }
-
-    /**
-     * Sets the password to use to connect to the FTP server
-     *
-     * @param $password
-     * @return void
-     */
-    public function setPassword($password)
-    {
-        $this->_password = $password;
-    }
-
-    /**
-     * Returns the password to use to connect to the FTP server
-     *
-     * @return string
-     */
-    public function getPassword()
-    {
-        return $this->_password;
-    }
-
-    /**
-     * Sets the path in the FTP server of the backup file
-     *
-     * @param $path
-     * @return void
-     */
-    public function setPath($path)
-    {
-        $this->_path = $path;
-    }
-
-    /**
-     * Gets the path in the FTP server of the backup file
-     *
-     * @return string
-     */
-    public function getPath()
-    {
-        return $this->_path;
-    }
-
-
-    /**
-     * Sets the host, username, password and file path to save the backup in an FTP server.
-     *
-     * @param array $arguments
-     */
-    public function setArguments(array $arguments)
-    {
-        $this->_host = isset($arguments['host'])?$arguments['host']:'';
-        $this->_username = isset($arguments['username'])?$arguments['username']:'';
-        $this->_password = isset($arguments['password'])?$arguments['password']:'';
-        $this->_path = isset($arguments['path'])?$arguments['path']:'';
-    }
-}
-}

tests/BackupStrategy/BackupStrategyAbstractTest.php

  * along with pleskbackup.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-use AAlba\PleskBackup\BackupStrategy\BackupStrategyAbstract;
+use AAlba\PleskBackup\BackupStrategy\DomainStrategyAbstract;
 
 /**
  *
 {
 
     /**
-     * @var \AAlba\PleskBackup\BackupStrategy\BackupStrategyAbstract
+     * @var \AAlba\PleskBackup\BackupStrategy\DomainStrategyAbstract
      */
     private
         $_stub;
 
     public function setUp()
     {
-        $this->_stub = $this->getMockForAbstractClass('\AAlba\PleskBackup\BackupStrategy\BackupStrategyAbstract');
+        $this->_stub = $this->getMockForAbstractClass('\AAlba\PleskBackup\BackupStrategy\DomainStrategyAbstract');
         $this->_stub->expects($this->any())->method('execute')->will($this->returnValue(null));
     }
     public function tearDown()

tests/BackupStrategy/PleskStandardStrategyTest.php

  * along with pleskbackup.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-use \AAlba\PleskBackup\BackupStrategy\PleskStandardStrategy;
+use \AAlba\PleskBackup\BackupStrategy\PleskDomainStandardStrategy;
 
 class PleskStandardStrategyTest extends PHPUnit_Framework_TestCase
 {
     /**
-     * @var \AAlba\PleskBackup\BackupStrategy\PleskStandardStrategy
+     * @var \AAlba\PleskBackup\BackupStrategy\PleskDomainStandardStrategy
      */
     private
         $_pleskStrategy;
 
     public function setUp()
     {
-        $this->_pleskStrategy = new PleskStandardStrategy();
+        $this->_pleskStrategy = new PleskDomainStandardStrategy();
     }
      public function tearDown()
      {
      }
     public function testThatPleskStandardStrategyExists()
     {
-        $domain = new PleskStandardStrategy();
-        $this->assertTrue($domain instanceof PleskStandardStrategy,"I should be able to create a class instance");
+        $domain = new PleskDomainStandardStrategy();
+        $this->assertTrue($domain instanceof PleskDomainStandardStrategy,"I should be able to create a class instance");
     }
 
     public function testThatICanSetPleskCommandArguments()
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.