PMCORE-4013 Wizard trigger: is using a old library thirdparty/wizard please research to use a new or Reflection

This commit is contained in:
Roly Gutierrez
2022-11-17 15:34:12 -04:00
parent 8640a0b209
commit 903a707561
11 changed files with 683 additions and 563 deletions

View File

@@ -0,0 +1,102 @@
<?php
namespace ProcessMaker\PHPReflectionClass;
use ProcessMaker\PHPReflectionClass\MethodStructure;
use Tests\TestCase;
class ClassStructureTest extends TestCase
{
/**
* Instance of ClassStructure.
* @var ClassStructure
*/
protected $object;
/**
* This setUp method.
*/
protected function setUp(): void
{
parent::setUp();
$this->object = new ClassStructure();
}
/**
* This test the method deleteInfo.
* @covers ProcessMaker\PHPReflectionClass\ClassStructure::deleteInfo
* @test
*/
public function testDeleteInfo()
{
//assert false
$result1 = $this->object->deleteInfo("test1");
$this->assertFalse($result1);
//assert true
$this->object->info["test2"] = [];
$result2 = $this->object->deleteInfo("test2");
$this->assertTrue($result2);
}
/**
* This test the method getInfo.
* @covers ProcessMaker\PHPReflectionClass\ClassStructure::getInfo
* @test
*/
public function testGetInfo()
{
//assert false
$result1 = $this->object->getInfo("test1");
$this->assertFalse($result1);
//assert true
$this->object->info["test2"] = [];
$result2 = $this->object->getInfo("test2");
$this->assertEquals([], $result2);
}
/**
* This test the method parseFromFile.
* @covers ProcessMaker\PHPReflectionClass\ClassStructure::parseFromFile
* @test
*/
public function testParseFromFile()
{
//assert false
$result1 = $this->object->parseFromFile("invalidPath");
$this->assertFalse($result1);
$filename = PATH_TRUNK . "tests/resources/ContentPHPSourceCode.txt";
$result2 = $this->object->parseFromFile($filename);
$this->assertTrue($result2);
}
/**
* This test the method setInfo.
* @covers ProcessMaker\PHPReflectionClass\ClassStructure::setInfo
* @test
*/
public function testSetInfo()
{
$this->object->setInfo("test1", "testing");
$this->assertEquals($this->object->info["test1"], "testing");
}
/**
* This test the method setMethod.
* @covers ProcessMaker\PHPReflectionClass\ClassStructure::setMethod
* @test
*/
public function testSetMethod()
{
//assert false
$result1 = $this->object->setMethod(null);
$this->assertFalse($result1);
//assert true
$method = new MethodStructure("testing");
$result2 = $this->object->setMethod($method);
$this->assertTrue($result2);
}
}

View File

@@ -0,0 +1,62 @@
<?php
namespace ProcessMaker\PHPReflectionClass;
use Tests\TestCase;
class MethodStructureTest extends TestCase
{
/**
* Instance of MethodStructure.
* @var MethodStructure
*/
protected $object;
/**
* This setUp method.
*/
protected function setUp(): void
{
parent::setUp();
$this->object = new MethodStructure("test");
}
/**
* This test the method getInfo.
* @covers ProcessMaker\PHPReflectionClass\MethodStructure::getInfo
* @test
*/
public function testGetInfo()
{
//assert false
$result1 = $this->object->getInfo("test");
$this->assertFalse($result1);
//assert true
$this->object->info["test2"] = [];
$result2 = $this->object->getInfo("test2");
$this->assertEquals([], $result2);
}
/**
* This test the method setInfo.
* @covers ProcessMaker\PHPReflectionClass\MethodStructure::setInfo
* @test
*/
public function testSetInfo()
{
$this->object->setInfo("test1", "test1");
$this->assertEquals("test1", $this->object->info["test1"]);
}
/**
* This test the method setParam.
* @covers ProcessMaker\PHPReflectionClass\MethodStructure::setParam
* @test
*/
public function testSetParam()
{
$this->object->setParam("test2", "test2");
$this->assertEquals("test2", $this->object->params["test2"]);
}
}