Ejemplo n.º 1
0
	/**
	 * Create section and 3 categories
	 */
	public function testCreateCategories() {
		$section = new KunenaForumCategory();
		$section->name = 'Section';
		$section->published = 1;
		$this->assertTrue($section->save(), $section->getError());
		$this->checkCategory($section);
		for ($i=1; $i<=3; $i++) {
			$category = new KunenaForumCategory();
			$category->name = "Category $i";
			$category->parent_id = $section->id;
			$category->published = 1;
			$this->assertTrue($category->save(), $category->getError());
			self::$category[$i] = $category;
			$this->checkCategory($category);
		}
	}
	/**
	 * Test delete()
	 *
	 * @param KunenaForumCategory $category
	 * @depends testRemoveModerator
	 */
	public function testDelete(KunenaForumCategory $category) {
		$this->assertTrue($category->delete(), $category->getError());
		$this->assertFalse($category->exists(), 'Check that deleted category does not exist');
		$this->assertNull($category->id, 'Check that deleted category id is null');
	}