Example #1
0
 public static function scar_generic_SCAR_clean()
 {
     self::$Author = null;
     self::$Entry = null;
     self::$EntryTag = null;
     self::$Tag = null;
     self::$datastore = null;
 }
Example #2
0
 public function setUp()
 {
     $this->Author = new SCAR_Generic();
     $this->Author->SCAR('scar_generic_SCAR');
     $this->Author->dsn(self::dsn);
     $this->Author->name('Author');
     $this->Author->fields(array('id' => TYPE_INT, 'name' => TYPE_STRING));
     $this->Author->primaryKey('id');
     $this->Author->table('authors');
     $this->Author->hasMany('entry');
     $this->Entry = new SCAR_Generic();
     $this->Entry->SCAR('scar_generic_SCAR');
     $this->Entry->dsn(self::dsn);
     $this->Entry->name('Entry');
     $this->Entry->fields(array('id' => TYPE_INT, 'author_id' => TYPE_INT, 'body' => TYPE_STRING));
     $this->Entry->primaryKey('id');
     $this->Entry->table('entries');
     $this->Entry->hasOne('author');
     $this->Entry->hasMany('entrytag');
     $this->EntryTag = new SCAR_Generic();
     $this->EntryTag->SCAR('scar_generic_SCAR');
     $this->EntryTag->dsn(self::dsn);
     $this->EntryTag->name('EntryTag');
     $this->EntryTag->fields(array('entry_id' => TYPE_INT, 'tag_id' => TYPE_INT));
     $this->EntryTag->primaryKey('entry_id', 'tag_id');
     $this->EntryTag->table('entries_tags');
     $this->EntryTag->hasOne('entry');
     $this->EntryTag->hasOne('tag');
     $this->Tag = new SCAR_Generic();
     $this->Tag->SCAR('scar_generic_SCAR');
     $this->Tag->dsn(self::dsn);
     $this->Tag->name('Tag');
     $this->Tag->fields(array('id' => TYPE_INT, 'name' => TYPE_STRING));
     $this->Tag->primaryKey('id');
     $this->Tag->table('tags');
     $this->Tag->hasMany('entrytag');
     // $this->datastore = $this->mock('SCAR_Datastore_Interface')
     //                       ->setReturnValue('set', true)
     //                       ->setReturnValue('get', false)
     //                       ->construct();
     // using live datastore object
     $this->datastore = new Scar_Datastore();
     scar_generic_SCAR::$Author = $this->Author;
     scar_generic_SCAR::$Entry = $this->Entry;
     scar_generic_SCAR::$EntryTag = $this->EntryTag;
     scar_generic_SCAR::$Tag = $this->Tag;
     scar_generic_SCAR::$datastore = $this->datastore;
 }