Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<?php
2
 
3
/*
4
 * This file is part of the symfony package.
5
 * (c) Fabien Potencier <fabien.potencier@symfony-project.com>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
 
11
/**
12
 * sfTester is the base class for all tester classes.
13
 *
14
 * @package    symfony
15
 * @subpackage test
16
 * @author     Fabien Potencier <fabien.potencier@symfony-project.com>
17
 * @version    SVN: $Id: sfTester.class.php 13691 2008-12-03 22:17:01Z Kris.Wallsmith $
18
 */
19
abstract class sfTester
20
{
21
  protected
22
    $inABlock = false,
23
    $browser  = null,
24
    $tester   = null;
25
 
26
  /**
27
   * Constructor.
28
   *
29
   * @param sfTestFunctionalBase $browser A browser
30
   * @param lime_test            $tester  A tester object
31
   */
32
  public function __construct(sfTestFunctionalBase $browser, $tester)
33
  {
34
    $this->browser = $browser;
35
    $this->tester  = $tester;
36
  }
37
 
38
  /**
39
   * Prepares the tester.
40
   */
41
  abstract public function prepare();
42
 
43
  /**
44
   * Initializes the tester.
45
   */
46
  abstract public function initialize();
47
 
48
  /**
49
   * Begins a block.
50
   *
51
   * @return sfTester This sfTester instance
52
   */
53
  public function begin()
54
  {
55
    $this->inABlock = true;
56
 
57
    return $this->browser->begin();
58
  }
59
 
60
  /**
61
   * Ends a block.
62
   *
63
   * @param sfTestFunctionalBase
64
   */
65
  public function end()
66
  {
67
    $this->inABlock = false;
68
 
69
    return $this->browser->end();
70
  }
71
 
72
  /**
73
   * Returns the object that each test method must return.
74
   *
75
   * @return sfTestFunctionalBase|sfTester
76
   */
77
  public function getObjectToReturn()
78
  {
79
    return $this->inABlock ? $this : $this->browser;
80
  }
81
 
82
  public function __call($method, $arguments)
83
  {
84
    call_user_func_array(array($this->browser, $method), $arguments);
85
 
86
    return $this->getObjectToReturn();
87
  }
88
}