[ Index ]

PHP Cross Reference of MantisBT

title

Body

[close]

/tests/soap/ -> VersionTest.php (source)

   1  <?php
   2  # MantisBT - A PHP based bugtracking system
   3  
   4  # MantisBT is free software: you can redistribute it and/or modify
   5  # it under the terms of the GNU General Public License as published by
   6  # the Free Software Foundation, either version 2 of the License, or
   7  # (at your option) any later version.
   8  #
   9  # MantisBT is distributed in the hope that it will be useful,
  10  # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12  # GNU General Public License for more details.
  13  #
  14  # You should have received a copy of the GNU General Public License
  15  # along with MantisBT.  If not, see <http://www.gnu.org/licenses/>.
  16  
  17  /**
  18   * @package Tests
  19   * @subpackage UnitTests
  20   * @copyright Copyright (C) 2002 - 2011  MantisBT Team - mantisbt-dev@lists.sourceforge.net
  21   * @link http://www.mantisbt.org
  22   */
  23  
  24  require_once  'SoapBase.php';
  25  
  26  /**
  27   * Test fixture for version methods
  28   */
  29  class VersionTest extends SoapBase {
  30  
  31      private function getTestVersion() {
  32  
  33          return array (
  34              'project_id' => $this->getProjectId(),
  35              'name' => '1.0',
  36              'released' => true,
  37              'description' => 'Test version',
  38              'date_order' => '',
  39              'obsolete' => false
  40          );
  41      }
  42  
  43      /**
  44       * Tests creating a new version
  45       */
  46      public function testAddVersion() {
  47          
  48          $versionId = $this->client->mc_project_version_add($this->userName, $this->password, $this->getTestVersion() );
  49          
  50          $this->assertNotNull( $versionId );
  51          
  52          $this->deleteVersionAfterRun( $versionId );
  53          
  54          $versions = $this->client->mc_project_get_versions( $this->userName, $this->password, $this->getProjectId() );
  55          
  56          $this->assertEquals(1, count($versions));
  57          
  58          $version = $versions[0];
  59          
  60          $this->assertEquals('1.0', $version->name);
  61          $this->assertEquals(true, $version->released);
  62          $this->assertEquals('Test version', $version->description);
  63          $this->assertEquals($this->getProjectId(), $version->project_id);
  64          $this->assertNotNull($version->date_order);
  65          $this->assertEquals(false, $version->obsolete);
  66      }
  67  
  68  
  69      /**
  70       * Tests updating a version
  71       */
  72      public function testUpdateVersion() {
  73          
  74          $versionId = $this->client->mc_project_version_add($this->userName, $this->password, $this->getTestVersion() );
  75          
  76          $this->assertNotNull( $versionId );
  77          
  78          $this->deleteVersionAfterRun( $versionId );
  79          
  80          $updatedVersion = $this->getTestVersion();
  81          $updatedVersion['name'] = '1.1';
  82          
  83          $this->client->mc_project_version_update ( $this->userName, $this->password, $versionId, $updatedVersion );
  84          
  85          $versions = $this->client->mc_project_get_versions( $this->userName, $this->password, $this->getProjectId() );
  86          
  87          $this->assertEquals(1, count($versions));
  88          
  89          $version = $versions[0];
  90          
  91          $this->assertEquals('1.1', $version->name);
  92      }
  93  }


Generated: Thu Jul 28 15:48:31 2011 Cross-referenced by PHPXref 0.7