summaryrefslogtreecommitdiff
path: root/test/TestTikiArticle.php
blob: b63cb9478b009a7e40a9ca2917a54bc841ef0bed (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
<?php
require_once '../../kernel/includes/setup_inc.php';
use Bitweaver\Articles\BitArticle;

class TestBitArticle extends Test
{
	public $test;
	public $id;
	public $count;

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

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

	public function testStoreItem()
	{
	$newItemHash = [
		"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));
	}

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

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

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

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

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

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

}