コード例 #1
0
ファイル: bootstrap.php プロジェクト: al-the-x/fakePhake
<?php

/**
 * @author David Rogers <*****@*****.**>
 * @package Unit_Tests
 * @category Bootstraps
 */
require_once 'Phake/Loader.php';
Phake_Loader::register();
require_once 'PHPUnit/Framework.php';
コード例 #2
0
ファイル: Csv.php プロジェクト: al-the-x/fakePhake
 /**
  * The load() method fetches data from a file in the filesystem, but
  * this could always be refactored later to pull from a data source.
  *
  * @param string $filename to load from or NULL to use the "in-file" option
  * @return Phake_Model_Csv for method chaining
  * @throws Phake_Model_Exception if $filename is invalid
  */
 public function load($filename = null)
 {
     /**
      * If the $filename is not specified, then the "infile" option should
      * contain the value we're after. If no value exists for that key, then
      * the $_Options object will throw an appropriate Exception.
      */
     $filename = is_null($filename) ? $this->getOption(self::OPTIONS_INFILE) : $filename;
     /**
      * Always polite to "look before you leap"...
      */
     if (!is_readable($filename)) {
         throw new Phake_Model_Exception('Provided filename is not readable: ' . $filename);
     }
     /**
      * Phake_Scripts_CsvLoad is a procedural script (hence the namespace) that
      * reads data from a CSV file and returns the $field_values and $field_names.
      *
      * @see Phake_Scripts_CsvLoad
      */
     list($field_values, $field_names) = Phake_Loader::loadScript('CsvLoad', array('get_fields' => $this->getOption(self::OPTIONS_GETFIELDS), 'infile' => $filename));
     /**
      * Ensure that $_values is always an array...
      */
     $this->_values = (array) $field_values;
     /**
      * Ensure that $_fields is a map of the $field_names to default values.
      */
     $this->_fields = array_combine($field_names, array_fill(0, count($field_names), null));
     $this->_loaded = true;
     return $this;
     // for method chaining
 }