DeleteTest.php 1.6 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
<?php
/**
 * Created by PhpStorm.
 * User: crose
 * Date: 1/15/16
 * Time: 8:24 AM
 */

namespace qfq;

11
require_once(__DIR__ . '/database/AbstractDatabaseTest.php');
12

13
14
15
16
/**
 * Class DeleteTest
 * @package qfq
 */
17
class DeleteTest extends AbstractDatabaseTest {
18
19
20
21
22
23

    /**
     * @expectedException \qfq\CodeException
     */
    public function testProcessException() {

24
        $delete = new Delete(true);
25
26

        // empty 'form' not allowed
27
        $delete->process('', 123);
28
29
30
31
32
33
34
    }

    /**
     * @expectedException \qfq\CodeException
     */
    public function testProcessException2() {

35
        $delete = new Delete(true);
36
37

        // empty record id not allowed
38
39
        $formName = 'Person';
        $delete->process($formName, '');
40
41
42
43
44
45
46
    }

    /**
     * @expectedException \qfq\CodeException
     */
    public function testProcessException3() {

47
        $delete = new Delete(true);
48
        $formName = 'Person';
49
50

        // record id = 0 not allowed
51
        $delete->process($formName, 0);
52
53
54
55
56
57
58
    }

    /**
     * @expectedException \qfq\CodeException
     */
    public function testProcessException4() {

59
        $delete = new Delete(true);
60
61
62

        // unknown table not allowed
        $form[F_TABLE_NAME] = 'UnknownTable';
63
        $delete->process($form, 0);
64
65
66
67
68
69
70
71
    }

    protected function setUp() {

        $this->store = Store::getInstance('form=TestFormName', true);
        parent::setUp();

        $this->store->setVar('form', 'TestFormName', STORE_TYPO3);
72
        $this->store->setVar(SYSTEM_SITE_PATH, '/tmp', STORE_SYSTEM, true);
73

74
        $this->executeSQLFile(__DIR__ . '/database/fixtures/Generic.sql', true);
75
76
77
    }

}