croogo /Taxonomy/Test/Case/Model/TaxonomyTest.php

Language PHP Lines 57
MD5 Hash 1730813e7c1d079e376e2cd95f1ac2f5
Repository https://github.com/kareypowell/croogo.git View Raw File View Project SPDX
 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
<?php
App::uses('Taxonomy', 'Taxonomy.Model');
App::uses('CroogoTestCase', 'Croogo.TestSuite');

class TaxonomyTest extends CroogoTestCase {

	public $fixtures = array(
		'plugin.users.aco',
		'plugin.users.aro',
		'plugin.users.aros_aco',
		'plugin.blocks.block',
		'plugin.comments.comment',
		'plugin.contacts.contact',
		'plugin.translate.i18n',
		'plugin.settings.language',
		'plugin.menus.link',
		'plugin.menus.menu',
		'plugin.contacts.message',
		'plugin.meta.meta',
		'plugin.nodes.node',
		'plugin.taxonomy.model_taxonomy',
		'plugin.blocks.region',
		'plugin.users.role',
		'plugin.settings.setting',
		'plugin.taxonomy.taxonomy',
		'plugin.taxonomy.term',
		'plugin.taxonomy.type',
		'plugin.taxonomy.types_vocabulary',
		'plugin.users.user',
		'plugin.taxonomy.vocabulary',
	);

	public function setUp() {
		parent::setUp();
		$this->Taxonomy = ClassRegistry::init('Taxonomy.Taxonomy');
	}

	public function tearDown() {
		parent::tearDown();
		unset($this->Taxonomy);
	}

	public function testGetTree() {
		$tree = $this->Taxonomy->getTree('categories');
		$expected = array(
			'uncategorized' => 'Uncategorized',
			'announcements' => 'Announcements',
		);
		$this->assertEqual($tree, $expected);
	}

	public function testTermInVocabulary() {
		$this->assertEquals(1, $this->Taxonomy->termInVocabulary(1, 1)); // Uncategorized in Categories
		$this->assertFalse($this->Taxonomy->termInVocabulary(1, 3)); // Uncategorized in non-existing vocabulary
	}
}
Back to Top