Changeset 3270

Show
Ignore:
Timestamp:
11/29/07 10:09:54 (2 years ago)
Author:
tamcy
Message:

#438: Updated test case syntax

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/tests/Ticket/438TestCase.php

    r3001 r3270  
    7878      $this->newStudentCourse($student1, $course2); 
    7979 
    80       // 1. Fetch relationship on demand 
     80 
     81      // 1. Fetch relationship on demand (multiple queries) 
    8182      $q = new Doctrine_Query(); 
    8283      $q->from('T438_StudentCourse sc') 
     
    9495      $q->select('sc.*, s.*, c.*') 
    9596        ->from('T438_StudentCourse sc, sc.Student s, sc.Course c') 
    96         ->where('sc.student_id = ? AND sc.course_id = ?',array('07090002', 'MATH001')); 
     97        ->where('sc.student_id = ? AND sc.course_id = ?',array('07090002', 'MATH001')) 
     98        ->execute(); 
    9799 
    98       $record = $q->execute()->getFirst(); 
     100      $record = $q->getFirst(); 
    99101      $this->assertEqual($record->student_id, '07090002'); 
    100102      $this->assertEqual($record->course_id,  'MATH001'); 
     
    118120  public function setUp() 
    119121  { 
    120     $this->hasMany('T438_Course as StudyCourses', array('refClass' => 'T438_StudentCourse', 'local' => 'sc_student_id', 'foreign' => 'sc_course_id')); 
     122    $this->hasMany('T438_Course as StudyCourses', array('refClass' => 'T438_StudentCourse', 'local' => 'student_id', 'foreign' => 'course_id')); 
    121123  } 
    122124} 
     
    135137  public function setUp() 
    136138  { 
    137     $this->hasMany('T438_Student as Students', array('refClass' => 'T438_StudentCourse', 'local' => 'sc_course_id', 'foreign' => 'sc_student_id')); 
     139    $this->hasMany('T438_Student as Students', array('refClass' => 'T438_StudentCourse', 'local' => 'course_id', 'foreign' => 'student_id')); 
    138140  } 
    139141} 
    140  
    141  
    142142 
    143143class T438_StudentCourse extends Doctrine_Record 
     
    149149    $this->hasColumn('sc_student_id as student_id', 'varchar', 30, array (  'primary' => true,)); 
    150150    $this->hasColumn('sc_course_id as course_id', 'varchar', 20, array (  'primary' => true,)); 
    151     $this->hasColumn('sc_remark as remark', 'varchar', 500, array ()); 
     151    $this->hasColumn('sc_remark  as remark', 'varchar', 500, array ()); 
    152152  } 
    153153   
    154154  public function setUp() 
    155155  { 
    156     $this->ownsOne('T438_Student as Student', array('local' => 'sc_student_id', 'foreign' => 's_id')); 
    157     $this->ownsOne('T438_Course as Course', array('local' => 'sc_course_id', 'foreign' => 'c_id')); 
     156    $this->hasOne('T438_Student as Student', array('local' => 'student_id', 'foreign' => 'id')); 
     157    $this->hasOne('T438_Course as Course', array('local' => 'course_id', 'foreign' => 'id')); 
    158158  } 
    159159}