summaryrefslogtreecommitdiff
path: root/test/TestTikiArticle.php
blob: 48e366039196aff2853f2b151fce1e6ebaf9b57e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<?php
require_once('../../kernel/setup_inc.php');
require_once(ARTICLES_PKG_PATH.'BitArticle.php');

class TestBitArticle extends Test {

    var $test;
    var $id;
    var $count;

    function TestBitArticle()
    {
        $this->test = new BitArticle();
        Assert::equalsTrue($this->test != NULL, 'Error during initialisation');
    }

    function testGetItems()
    {
	$filter = array();
        $list = $this->test->getList($filter);
        $this->count = count($list);
        Assert::equalsTrue(is_array($list));
    }

    function testStoreItem()
    {
	$newItemHash = array(
		"title" => "Test Title",
		"description" => "Test Description",
		"data" => "Test Text",
		"topic_id" => NULL,
		"topic_name" => NULL,
		"size" => NULL,
		"use_image" => NULL,
		"image_name" => NULL,
		"image_type" => NULL,
		"image_size" => NULL,
		"image_x" => NULL,
		"image_y" => NULL,
		"image_data" => "",
		"publish_date" => NULL,
		"expire_date" => NULL,
		"hash" => NULL,
		"type" => NULL,
		"isfloat" => NULL,
	);
        Assert::equalsTrue($this->test->store($newItemHash));
    }

    function testIsValidItem()
    {
        Assert::equalsTrue($this->test->isValid());
    }

    function testNullItem()
    {
	$this->id = $this->test->mArticleId;
        $this->test = NULL;
        Assert::equals($this->test, NULL);
    }

    function testLoadItem()
    {
        $this->test = new BitArticle($this->id);
        Assert::equals($this->test->load(), 37);
    }

    function testUrlItem()
    {
        Assert::equalsTrue($this->test->getDisplayUrl() != "");
    }

    function testExpungeItem()
    {
        Assert::equalsTrue($this->test->expunge());
    }

    function testCountItems()
    {
	$filter = array();
        $count = count($this->test->getList($filter));
        Assert::equals($this->count, $count);
    }

}
?>