~ubuntu-branches/ubuntu/maverick/gallery2/maverick

« back to all changes in this revision

Viewing changes to lib/tools/repository/test/phpunit/RepositoryTestTemplate.class

  • Committer: Bazaar Package Importer
  • Author(s): Michael C. Schultheiss
  • Date: 2007-09-10 20:22:19 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20070910202219-0jsuntvqge4ade6b
Tags: 2.2.3-2
Add Slovak translation of Debconf templates.  (Thanks to 
Ivan Masá.  Closes: #441671)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<?php
2
 
/*
3
 
 * Gallery - a web based photo album viewer and editor
4
 
 * Copyright (C) 2000-2007 Bharat Mediratta
5
 
 *
6
 
 * This program is free software; you can redistribute it and/or modify
7
 
 * it under the terms of the GNU General Public License as published by
8
 
 * the Free Software Foundation; either version 2 of the License, or (at
9
 
 * your option) any later version.
10
 
 *
11
 
 * This program is distributed in the hope that it will be useful, but
12
 
 * WITHOUT ANY WARRANTY; without even the implied warranty of
13
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
 
 * General Public License for more details.
15
 
 *
16
 
 * You should have received a copy of the GNU General Public License
17
 
 * along with this program; if not, write to the Free Software
18
 
 * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA  02110-1301, USA.
19
 
 */
20
 
 
21
 
/**
22
 
 * @version $Revision: 15513 $
23
 
 * @package RepositoryTools
24
 
 * @subpackage PHPUnit
25
 
 * @author Jozef Selesi <selesi at gmail dot com>
26
 
 */
27
 
 
28
 
/**
29
 
 * Mock GalleryTemplate for testing the repository classes.
30
 
 *
31
 
 * Contents to be returned by fetch can be set in the contrucor,
32
 
 * and set variables can be examined with getVariables().
33
 
 *
34
 
 * @package RepositoryTools
35
 
 * @subpackage PHPUnit
36
 
 */
37
 
class RepositoryTestTemplate {
38
 
    var $_templateContents;
39
 
    var $_variables;
40
 
 
41
 
    function RepositoryTestTemplate($templateContents = '', $contentsVariable = '') {
42
 
        $this->_templateContents = $templateContents;
43
 
 
44
 
        if (!empty($contentsVariable)) {
45
 
            $this->_variables['contents'] = $contentsVariable;
46
 
        }
47
 
    }
48
 
 
49
 
    function setVariable($key, $value) {
50
 
        $this->_variables[] = $key == 'random' ? array($key => 'random')
51
 
                                               : array($key => $value);
52
 
    }
53
 
 
54
 
    function hasVariable($key) {
55
 
        return isset($this->_variables[$key]);
56
 
    }
57
 
 
58
 
    function getVariable($key) {
59
 
        return $this->_variables[$key];
60
 
    }
61
 
 
62
 
    function getVariables() {
63
 
        return $this->_variables;
64
 
    }
65
 
 
66
 
    function fetch($template) {
67
 
        return array(null, $this->_templateContents);
68
 
    }
69
 
}
70
 
?>