1 | <?php |
||
3 | abstract class AbstractControllerTestCase extends Zend_Test_PHPUnit_ControllerTestCase |
||
4 | { |
||
5 | /** |
||
6 | * @var \mQueue\Model\User |
||
7 | */ |
||
8 | protected $testUser; |
||
9 | protected $userData = [ |
||
10 | 'nickname' => 'test user', |
||
11 | 'email' => '[email protected]', |
||
12 | 'password' => 'superpassword', |
||
13 | ]; |
||
14 | protected $movieData = [ |
||
15 | 'id' => '0096446', |
||
16 | 'title' => 'Willow (1988)', |
||
17 | ]; |
||
18 | |||
19 | public function setUp(): void |
||
20 | { |
||
21 | $this->bootstrap = new Zend_Application( |
||
22 | APPLICATION_ENV, [ |
||
23 | 'config' => [ |
||
24 | APPLICATION_PATH . '/configs/application.ini', |
||
25 | ], ] |
||
26 | ); |
||
27 | |||
28 | $this->testUser = \mQueue\Model\UserMapper::findEmailPassword($this->userData['email'], $this->userData['password']); |
||
29 | if (!$this->testUser) { |
||
30 | $this->testUser = \mQueue\Model\UserMapper::insertUser($this->userData); |
||
31 | } |
||
32 | |||
33 | $movie = \mQueue\Model\MovieMapper::find($this->movieData['id']); |
||
34 | if (!$movie) { |
||
35 | \mQueue\Model\MovieMapper::getDbTable()->createRow($this->movieData)->save(); |
||
36 | } |
||
37 | |||
38 | parent::setUp(); |
||
39 | } |
||
40 | |||
41 | public function loginUser($login, $password): void |
||
54 | } |
||
55 | |||
56 | /** |
||
57 | * Assert against plain text search; content should contain needle |
||
58 | * |
||
59 | * @param string $needle needle that should be contained in content |
||
60 | * @param string $message |
||
61 | */ |
||
62 | public function assertContentContains($needle, $message = ''): void |
||
73 | } |
||
74 | } |
||
75 | } |
||
76 |