Pastoid

Habari Vocabulary stuff

The page you are looking at now is at this URL: http://pastoid.com/awu

This paste was last updated on April 25, 2009 at 8:48 pm.

Vocabulary class embryonic unit testraw

<?php
 
 
class system_classes_VocabularyTest extends PHPUnit_Framework_TestCase
{
 
	public function testConstruct()
	{
		$b = new Bitmask(array('hierarchical', 'unique', 'required', 'free'));
		$b->hierarchical = true;
		$v = new Vocabulary('test', 'test vocab', $b);
 
		$this->assertType('Vocabulary', $v);
		$this->assertEquals($v->name, 'test');
		$this->assertEquals($v->description, 'test vocab');
		$this->assertEquals(1, $v->required);
	}
}
?>

Toggle wordwrap

vocabulary.phpraw

<?php
 
/**
 * Vocabulary Class
 * 
 *
 * @version $Id$
 * @copyright 2009
 */
 
class Vocabulary extends QueryRecord
{
	/**
	 * Return the defined database columns for a Post.
	 * @return array Array of columns in the Post table
	 **/
	public static function default_fields()
	{
		return array(
			'id' => 0,
			'name' => '',
			'description' => '',
			'required' => 0,
		);
	}
 
 
	/**
	 * Vocabulary constructor
	 * Creates a Vocabulary instance
	 * 
	 * @param string $name The name of the Vocabulary
	 * @param string $description A description of the Vocabulary 
	 * @param BitMask $properties Properties of this Vocabulary
	 */
	public function __construct($name, $description, BitMask $properties)
	{
		// Defaults
		$this->fields = array_merge(
			self::default_fields(),
			$this->fields,
			$this->newfields
		);
 
		$paramarray = array(
			'name'=> $name,
			'description' => $description,
			'required' => $properties->value,
		);
 
		parent::__construct( $paramarray );
 
		$this->exclude_fields( 'id' );
	}
 
}
 
?>

Toggle wordwrap

Referring DomainHits
Unknown Referer 158
pastoid.com 10
search.live.com 3
Is this paste spam?
<Hide