Inheritance: extends PHPUnit_Framework_TestCase
Example #1
0
 public function setUp()
 {
     parent::setUp();
     $t = $this->table('user', array('userid' => new Types\IntegerType(8, 'primary auto_increment'), 'name' => new Types\StringType(), 'value' => new Types\IntegerType(), 'active' => new Types\BooleanType()));
     $t->insert(array('name' => 'Llama', 'active' => false, 'value' => 24));
     $t->insert(array('name' => 'Drama', 'active' => true, 'value' => NULL));
 }
Example #2
0
 public function setUp()
 {
     parent::setUp();
     $this->pool = new SequencePool($this->pheasant->connection());
     $this->pool->initialize()->clear();
     $this->assertTableExists(SequencePool::TABLE);
 }
Example #3
0
 public function setUp()
 {
     parent::setUp();
     $migrator = new \Pheasant\Migrate\Migrator();
     $migrator->create('animal', Animal::schema());
     Animal::import(array(array('name' => 'Llama', 'type' => 'llama'), array('name' => 'Blue Frog', 'type' => 'frog'), array('name' => 'Red Frog', 'type' => 'frog')));
 }
Example #4
0
 public function setUp()
 {
     parent::setUp();
     $this->table = $this->table('user', array('userid' => new Types\IntegerType(8, 'primary auto_increment'), 'firstname' => new Types\StringType(), 'lastname' => new Types\StringType()));
     $this->table->insert(array('firstname' => 'Llama', 'lastname' => 'Herder'));
     $this->table->insert(array('firstname' => 'Action', 'lastname' => 'Hero'));
     $this->assertRowCount(2, 'select * from user');
 }
Example #5
0
 public function setUp()
 {
     parent::setUp();
     $migrator = new \Pheasant\Migrate\Migrator();
     $migrator->create('hero', Hero::schema())->create('power', Power::schema())->create('secretidentity', SecretIdentity::schema());
     $this->spiderman = Hero::createHelper('Spider Man', 'Peter Parker', array('Super-human Strength', 'Spider Senses'));
     $this->superman = Hero::createHelper('Super Man', 'Clark Kent', array('Super-human Strength', 'Invulnerability'));
     $this->batman = Hero::createHelper('Batman', 'Bruce Wayne', array('Richness', 'Super-human Intellect'));
 }
Example #6
0
 public function setUp()
 {
     parent::setUp();
     $migrator = new \Pheasant\Migrate\Migrator();
     $migrator->create('hero', Hero::schema())->create('power', Power::schema())->create('secretidentity', SecretIdentity::schema());
     $this->pheasant->connection()->execute('INSERT INTO sequences (name, id) VALUES (?, ?)', array('SECRETIDENTITY_ID_SEQ', 100));
     $spiderman = Hero::createHelper('Spider Man', 'Peter Parker', array('Super-human Strength', 'Spider Senses'));
     $superman = Hero::createHelper('Super Man', 'Clark Kent', array('Super-human Strength', 'Invulnerability'));
     $batman = Hero::createHelper('Batman', 'Bruce Wayne', array('Richness', 'Super-human Intellect'));
 }
Example #7
0
 public function setUp()
 {
     parent::setUp();
     // set up a domain object
     $this->initialize('Pheasant\\DomainObject', function ($builder) {
         $builder->properties(array('id' => new Types\IntegerType(null, 'primary auto_increment'), 'value' => new Types\StringType()));
     });
     // set up tables
     $this->pheasant->register('Pheasant\\DomainObject', new RowMapper('domainobject'));
     $this->migrate('domainobject', DomainObject::schema());
 }
Example #8
0
 public function setUp()
 {
     parent::setUp();
     // set up a domain object
     $this->initialize('Pheasant\\DomainObject', function ($builder) {
         $builder->properties(array('id' => new Types\IntegerType(null, 'primary auto_increment'), 'type' => new Types\StringType(128), 'isllama' => new Types\BooleanType(array('default' => true)), 'weight' => new Types\DecimalType(5, 1), 'timecreated' => new Types\DateTimeType(), 'unixtime' => new Types\UnixTimestampType(), 'camelidvariant' => new Types\StringType(128, array('allowed' => array('llama', 'alpaca')))));
     });
     // set up tables
     $this->pheasant->register('Pheasant\\DomainObject', new RowMapper('domainobject'));
     $this->migrate('domainobject', DomainObject::schema());
 }
Example #9
0
 public function setUp()
 {
     parent::setUp();
     $migrator = new \Pheasant\Migrate\Migrator();
     $migrator->create('animal', Animal::schema());
     $this->queries = array();
     $test = $this;
     $this->connection()->filterChain()->onQuery(function ($sql) use($test) {
         $test->queries[] = $sql;
         return $sql;
     });
 }
Example #10
0
 public function setUp()
 {
     parent::setUp();
     $migrator = new \Pheasant\Migrate\Migrator();
     $migrator->create('user', User::schema())->create('userpref', UserPref::schema());
     // create some users
     $this->users = User::import(array(array('firstname' => 'Frank', 'lastname' => 'Castle'), array('firstname' => 'Cletus', 'lastname' => 'Kasady')));
     // create some user prefs
     $this->userprefs = UserPref::import(array(array('User' => $this->users[0], 'pref' => 'autologin', 'value' => 'yes'), array('User' => $this->users[1], 'pref' => 'autologin', 'value' => 'no')));
     $this->assertTrue($this->userprefs[0]->User->equals($this->users[0]));
     $this->assertTrue($this->userprefs[1]->User->equals($this->users[1]));
 }
Example #11
0
 public function setUp()
 {
     parent::setUp();
     $migrator = new \Pheasant\Migrate\Migrator();
     $migrator->destroy(Animal::schema())->initialize(Animal::schema())->destroy(Order::schema())->initialize(Order::schema());
 }
Example #12
0
 public function setUp()
 {
     parent::setUp();
     $table = $this->table('person', array('personid' => new SequenceType(), 'name' => new StringType()));
 }
Example #13
0
 public function setUp()
 {
     parent::setUp();
     $this->table('post', array('postid' => new Types\IntegerType(11, 'primary auto_increment'), 'title' => new Types\StringType(255, 'required'), 'subtitle' => new Types\StringType(255)));
 }
Example #14
0
 public function setUp()
 {
     parent::setUp();
 }
Example #15
0
 public function setUp()
 {
     parent::setUp();
     $migrator = new \Pheasant\Migrate\Migrator();
     $migrator->create('hero', Hero::schema())->create('power', Power::schema())->create('secretidentity', SecretIdentity::schema());
 }
Example #16
0
 public function setUp()
 {
     parent::setUp();
     $this->mapper = \Mockery::mock('\\Pheasant\\Mapper\\Mapper');
 }