Пример #1
0
	/**
	 * @covers Bedrock::properties
	 *
	 * @return void
	 */
	public function testProperties() {
		// Setup
		$properties = $this->_object->properties();

		// Assertions
		$this->assertInstanceOf('Bedrock\\Common\\Config', $properties);
		$this->assertCount((4 + 1), $properties); // PHPUnit adds __phpunit_mockObjectId, so count ends up being +1

		foreach($this->_mockConfig as $key => $value) {
			$this->assertEquals($value, $properties[$key]);
		}
	}
Пример #2
0
	/**
	 * The default constructor.
	 *
	 * @return \Bedrock\View
	 */
	public function __construct() {
		parent::__construct();
		$this->_webroot = $this->_config->root->web . 'templates/' . $this->_config->template . '/';
		$this->_imgroot = $this->_webroot . 'images/';
		$this->_pageroot = $this->_webroot . 'pages/';
		$this->_root = 'pub/templates/' . $this->_config->template . '/pages/';
	}
Пример #3
0
	/**
	 * Initializes a database connection.
	 *
	 * @param mixed $databaseConfig the database configuration
	 */
	public function __construct($databaseConfig) {
		try {
			// Build Connection String
			$dsn = $databaseConfig->type . ':host=' . $databaseConfig->host . ';dbname=' . $databaseConfig->dbname;
			
			\Bedrock\Common\Logger::info('Connecting to database "' . $databaseConfig->dbname . '" on "' . $databaseConfig->host . '"...');
			
			// Set Properties
			switch($databaseConfig->type) {
				case 'mysql':
					$this->_type = self::DB_TYPE_MYSQL;
					break;
			}
			
			// Initialize Database Connection
			$this->_connection = new \PDO($dsn, $databaseConfig->username, $databaseConfig->password);
			$this->_name = $databaseConfig->dbname;
			$this->_dbConfig = $databaseConfig;
			
			parent::__construct();
		}
		catch(\PDOException $ex) {
			\Bedrock\Common\Logger::exception($ex);
			throw new \Bedrock\Model\Exception('There was a problem retrieving the table information.');
		}
		catch(\Exception $ex) {
			\Bedrock\Common\Logger::exception($ex);
			throw new \Bedrock\Model\Exception('There was a problem connecting to the database.');
		}
	}
Пример #4
0
	/**
	 * Initializes the view object. This particular class should not be
	 * instantiated directly and should insted be used through its static
	 * methods.
	 */
	public function __construct() {
		try {
			parent::__construct();
		}
		catch(\Exception $ex) {
			\Bedrock\Common\Logger::exception($ex);
		}
	}
Пример #5
0
	/**
	 * Initializes the growl class with the specified app name (if specified).
	 *
	 * @param string $address the IP address of the system running Growl
	 * @param string $password the password to use
	 * @param string $app_name a name to use when sending notifications to Growl
	 * @return void
	 */
	public function __construct($address, $password = '', $app_name = null) {
		$this->_address = $address;
		$this->_password = $password;
		
		if(isset($app_name))
			$this->_appName = utf8_encode($app_name);
			
		parent::__construct();
	}
Пример #6
0
	/**
	 * Initializes the router, establishing protected config and logger objects.
	 *
	 * @param string $delegationQueue a list of root controller classes in order of precedence for delegation
	 */
	public function __construct($delegationQueue = array()) {
		if(count($delegationQueue) == 0) {
			$this->defaultDelegationQueue();
		}
		else {
			foreach($delegationQueue as $rootController) {
				$this->addToDelegationQueue($rootController);
			}
		}

		parent::__construct();
	}
Пример #7
0
	/**
	 * Initializes the object.
	 *
	 * @param $database \Bedrock\Model\Database the database object to use
	 */
	public function __construct($database = null) {
		if($database) {
			$this->_database = $database;
		}
		else {
			$this->_database = \Bedrock\Common\Registry::get('database');
		}

		$this->_connection = $this->_database->getConnection();

		parent::__construct();
	}
Пример #8
0
	/**
	 * Applies any default properties for the current object.
	 */
	public function defaults() {
		try {
			parent::defaults();
			
			$this->_properties->merge(new \Bedrock\Common\Config(array(
				'name' => 'group',
				'label' => 'Group'
			)), true);
		}
		catch(\Exception $ex) {
			\Bedrock\Common\Logger::exception($ex);
		}
	}
Пример #9
0
	/**
	 * Applies any default properties for the current object.
	 */
	public function defaults() {
		try {
			parent::defaults();
			
			$this->_properties->merge(new \Bedrock\Common\Config(array(
				'name' => 'form',
				'id' => 'form',
				'method' => 'post',
				'action' => $_SERVER['PHP_SELF']
			)), true);
		}
		catch(\Exception $ex) {
			\Bedrock\Common\Logger::exception($ex);
		}
	}
Пример #10
0
	/**
	 * Applies any default properties for the current object.
	 */
	public function defaults() {
		try {
			parent::defaults();
			
			$this->_properties->merge(new \Bedrock\Common\Config(array(
				'name' => 'field',
				'label' => 'Field',
				'type' => 'std',
				'subtype' => 'text'
			)), true);
		}
		catch(\Exception $ex) {
			\Bedrock\Common\Logger::exception($ex);
		}
	}
Пример #11
0
	/**
	 * Default Constructor
	 *
	 * @param array $args the Growl initialization arguments
	 */
	public function __construct($args = array()) {
		parent::__construct();
		$this->open($args);
	}
Пример #12
0
	/**
	 * Initializes the DataFormat object.
	 */
	public function __construct() {
		parent::__construct();
	}