Exemplo n.º 1
0
 public function testModelNamespaces()
 {
     $this->setFixtureClass(array('fax_jobs' => 'Fax_Job', 'fax_recipients' => 'Fax_Recipient'));
     $this->fixtures('fax_jobs', 'fax_recipients');
     $job = Fax_Job::find($this->fax_jobs('fax_job_1')->id);
     $this->assertInstanceOf("Fax_Job", $job);
     $this->assertEquals('fax_jobs', $job->tableName());
 }
Exemplo n.º 2
0
 public function testFindIncludeNamespacedModels()
 {
     $this->setFixtureClass(array('fax_jobs' => 'Fax_Job', 'fax_recipients' => 'Fax_Recipient', 'fax_attachments' => 'Fax_Attachment'));
     $this->fixtures('articles', 'fax_jobs', 'fax_recipients', 'fax_attachments');
     $jobs = Fax_Job::find('all', array('order' => 'fax_jobs.id', 'include' => array('Fax_Recipients', 'Articles')));
     // 5 total jobs
     $this->assertEquals(2, count($jobs));
     $job = $jobs[0];
     // first job has 2 recipients
     $this->assertEquals(2, count($job->fax_recipients));
     // and two articles
     $this->assertEquals(2, count($job->articles));
     // and two attachments
     $this->assertEquals(2, count($job->fax_attachments));
 }