public function test_04() { $m = new Model01(); $ar = SWHelper::nextStatuslistData($m, array('exclude' => 'workflow1/S2,workflow1/S3')); $this->assertTrue(is_array($ar)); $this->assertEquals(count($ar), 1); $this->assertTrue(isset($ar['workflow1/S1'])); $this->assertEquals($ar['workflow1/S1'], 'status S1'); // exclude status as comma separated list with no workflow id and additional spaces $ar = SWHelper::nextStatuslistData($m, array('exclude' => 'S2, S3')); $this->assertTrue(is_array($ar)); $this->assertEquals(count($ar), 1); $this->assertTrue(isset($ar['workflow1/S1'])); $this->assertEquals($ar['workflow1/S1'], 'status S1'); $ar = SWHelper::allStatuslistData($m); $this->assertEquals(count($ar), 5); $ar = SWHelper::allStatuslistData($m, array('includeCurrent' => false)); $this->assertEquals(count($ar), 4); $this->assertTrue(isset($ar['workflow1/S1']) == false); $ar = SWHelper::allStatuslistData($m, array('exclude' => array('S1', 'S2', 'S3', 'S4', 'S5'))); $this->assertEquals(count($ar), 0); }
/** * Finds simple workflow status label * @param string status id * @return string label */ public function getLabelByStatus($status) { $status = $this->swDbStatus($status); $nodes = SWHelper::allStatuslistData($this); return isset($nodes[$status]) ? $nodes[$status] : null; }