Merged in bugfix/PMCORE-635 (pull request #7295)

PMCORE-635

Approved-by: Paula Quispe <paula.quispe@processmaker.com>
This commit is contained in:
Julio Cesar Laura Avendaño
2020-03-27 18:04:53 +00:00
2 changed files with 30 additions and 5 deletions

View File

@@ -963,6 +963,27 @@ class PmDynaformTest extends TestCase
$this->assertEquals(strlen($sqlOriginal), strlen($sqlParsed)); $this->assertEquals(strlen($sqlOriginal), strlen($sqlParsed));
} }
/**
* Review if the title of a Dynaform is correct
*
* @covers PmDynaform::getDynaformTitle()
* @test
*/
public function it_should_get_dynaform_title()
{
// Create a Dynaform
$dynaform = factory(Dynaform::class)->create([]);
// Instance the class to test
$pmDynaform = new PmDynaform();
// Get the title of the Dynaform
$dynaformTitle = $pmDynaform->getDynaformTitle($dynaform->DYN_UID);
// Compare the values
$this->assertEquals($dynaformTitle, $dynaform->DYN_TITLE);
}
} }
// Dummy function used for the coverture // Dummy function used for the coverture

View File

@@ -149,12 +149,16 @@ class PmDynaform
return $labelsPo; return $labelsPo;
} }
public function getDynaformTitle($idDynaform) /**
* Get the title of a Dynaform
*
* @param string $dynUid
* @return string
*/
public function getDynaformTitle($dynUid)
{ {
$d = new Dynaform(); $dynaform = ModelDynaform::getByDynUid($dynUid);
$d->setDynUid($idDynaform); return $dynaform->DYN_TITLE;
$titleDynaform = $d->getDynTitle();
return $titleDynaform;
} }
/** /**