This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Phone_carrier_model extends CI_Model { | |
function __construct() | |
{ | |
parent::__construct(); | |
} | |
public function getCarriers($attributes) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Phone_carrier_model extends CI_Model { | |
function __construct() | |
{ | |
parent::__construct(); | |
} | |
public function getCarriers($attributes) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); | |
class Welcome extends CI_Controller { | |
function __construct() { | |
parent::__construct(); | |
$this->load->spark('php-activerecord/0.0.1'); | |
} | |
public function index() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include_once dirname(__FILE__) . '/../support/enviromment.php'; | |
/** | |
* @group models | |
*/ | |
class PersonTest extends CIUnit_TestCase { | |
public function setUp() { | |
$this->CI->load->spark('php-activerecord/0.0.1'); | |
parent::setUp(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "open3" | |
watch("application/(models|controllers)/(.*).php") do |match| | |
test_changed_application(match[0]) | |
end | |
watch("tests/(.*/.*)\.php") do |match| | |
phpunit match[0] | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Student extends Person { | |
static $primary_key = 'id'; | |
static $has_many = array(array('enrollments')); | |
public function __construct(array $attributes = array()) { | |
parent::__construct(array_merge($attributes,array('type'=> __CLASS__ ))); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @group Helper | |
*/ | |
class PartialsHelperTest extends CIUnit_TestCase | |
{ | |
public function setUp() | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Account extends ActiveRecord\Model { | |
static $belongs_to = array( | |
array('person') | |
); | |
static $validates_inclusion_of = array( | |
array('provider', 'in' => array('twitter','facebook'), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include_once dirname(__FILE__) . '/../support/enviromment.php'; | |
/** | |
* @group models | |
*/ | |
class AccountTest extends CIUnit_TestCase | |
{ | |
protected $tables = array( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
context "create questions and answers for the exam" do | |
let(:build_object) { mock().as_null_object } | |
it "should instantiate at least 3 questions" do | |
exam_questions = mock("questions for an exam").as_null_object | |
Exam.any_instance.stub(:questions).and_return(exam_questions) | |
exam_questions.stub(:build).and_return(build_object) | |
exam_questions.should_receive(:build).exactly(3).times | |
get :new |