예제 #1
0
 /**
  *
  *
  */
 public function testInitialisation4()
 {
     $m = Model03::model()->findByPk('2');
     $this->assertEquals($m->swGetWorkflowId(), 'workflow1');
     $this->assertEquals($m->swGetDefaultWorkflowId(), 'workflow1');
     $this->assertTrue($m->swHasStatus());
     $this->assertEquals($m->swGetStatus()->toString(), 'workflow1/S2');
     $this->assertFalse($m->swIsInitialStatus($m->swGetStatus()));
     $this->assertFalse($m->swIsInitialStatus('workflow1/S2'));
     $this->assertTrue($m->swIsInitialStatus('S1'));
     $this->assertFalse($m->swIsInitialStatus());
     $this->assertEquals(count($m->swGetAllStatus()), 5);
     $this->assertEquals($m->swIsEventEnabled(), false);
 }
예제 #2
0
 /**
  *
  */
 public function testInitialisation3()
 {
     $m = new Model03();
     // autoInsert=false, workflow=workflow1
     $this->assertEquals($m->swHasStatus(), false);
     $this->assertEquals($m->swGetWorkflowId(), null);
     $this->assertEquals($m->swGetDefaultWorkflowId(), 'workflow1');
     $this->assertEquals(count($m->swGetAllStatus()), 0);
     $this->assertEquals($m->swGetStatus(), null);
     $this->assertEquals($m->swIsEventEnabled(), false);
     $this->assertFalse($m->swIsFinalStatus());
     $continue = true;
     try {
         $this->assertTrue($m->swIsInitialStatus($m->swGetStatus()));
         $continue = false;
     } catch (Exception $e) {
         $this->assertEquals($e->getCode(), SWException::SW_ERR_CREATE_FAILS);
     }
     $this->assertTrue($continue);
     $this->assertTrue($m->swIsInitialStatus('workflow1/S1'));
     $this->assertTrue($m->swIsInitialStatus('S1'));
     // lazy workflow insertion
     $m->swInsertToWorkflow();
     $this->assertEquals($m->swGetWorkflowId(), 'workflow1');
     $this->assertEquals($m->swGetDefaultWorkflowId(), 'workflow1');
     $this->assertTrue($m->swHasStatus());
     $this->assertTrue($m->swIsInitialStatus());
     $this->assertEquals($m->swGetStatus()->toString(), 'workflow1/S1');
     $this->assertEquals(count($m->swGetAllStatus()), 5);
     $this->assertEquals($m->swIsEventEnabled(), false);
     $this->assertTrue($m->swIsInitialStatus($m->swGetStatus()));
     $this->assertTrue($m->swIsInitialStatus('workflow1/S1'));
     $this->assertTrue($m->swIsInitialStatus('S1'));
     $this->assertFalse($m->swIsFinalStatus());
 }