<?php /** * Created by PhpStorm. * User: Stepan * Date: 12.02.2016 * Time: 22:13 */ require 'config.php'; require 'menu.php'; use StepanSib\AlmClient\AlmClient; use StepanSib\AlmClient\AlmEntity; use StepanSib\AlmClient\AlmEntityManager; $almClient = new AlmClient($connectionParams); $defectsRawResponse = $almClient->getManager()->getBy(AlmEntityManager::ENTITY_TYPE_DEFECT, array('' => '>=50000', 'status' => 'Open', 'owner' => 'syudin'), AlmEntityManager::HYDRATION_NONE); echo $defectsRawResponse;
<?php /** * Created by PhpStorm. * User: Stepan * Date: 14.02.2016 * Time: 1:19 */ require 'config.php'; require 'header_xml.php'; use StepanSib\AlmClient\AlmClient; $almClient = new AlmClient($connectionParams); echo $almClient->getManager()->getParametersManager()->getLists()->asXML();
<?php /** * Created by PhpStorm. * User: Stepan * Date: 09.02.2016 * Time: 22:37 */ require 'config.php'; require 'menu.php'; use StepanSib\AlmClient\AlmClient; $almClient = new AlmClient($connectionParams); $almClient->getAuthenticator()->logout(); echo 'Logged out';
<?php /** * Created by PhpStorm. * User: Stepan * Date: 09.02.2016 * Time: 22:39 */ require 'config.php'; require 'menu.php'; use StepanSib\AlmClient\AlmClient; $almClient = new AlmClient($connectionParams); echo $almClient->getAuthenticator()->login()->isAuthenticated() ? "Authenticated" : "Not authenticated";
<?php /** * Created by PhpStorm. * User: Stepan * Date: 15.02.2016 * Time: 21:23 */ require 'config.php'; require 'menu.php'; use StepanSib\AlmClient\AlmClient; use StepanSib\AlmClient\AlmEntity; use StepanSib\AlmClient\AlmEntityManager; $almClient = new AlmClient($connectionParams); $entity = $almClient->getManager()->getOneBy(AlmEntityManager::ENTITY_TYPE_DEFECT, array('id' => $defectId)); $almClient->getManager()->delete($entity); echo 'Entity has been deleted';
<?php /** * Created by PhpStorm. * User: Stepan * Date: 15.02.2016 * Time: 13:21 */ require 'config.php'; require 'menu.php'; use StepanSib\AlmClient\AlmClient; use StepanSib\AlmClient\AlmEntity; use StepanSib\AlmClient\AlmEntityManager; $almClient = new AlmClient($connectionParams); $defectEditableFields = $almClient->getManager()->getEntityEditableParameters(AlmEntityManager::ENTITY_TYPE_DEFECT); ?> <pre> <?php echo var_export($defectEditableFields, true); ?> </pre>
<?php /** * Created by PhpStorm. * User: Stepan * Date: 13.02.2016 * Time: 16:50 */ require 'config.php'; require 'menu.php'; use StepanSib\AlmClient\AlmClient; use StepanSib\AlmClient\AlmEntity; use StepanSib\AlmClient\AlmEntityManager; $almClient = new AlmClient($connectionParams); $defectRequiredFields = $almClient->getManager()->getParametersManager()->getEntityTypeFields(AlmEntityManager::ENTITY_TYPE_DEFECT, true); ?> <pre> <?php echo var_export($defectRequiredFields, true); ?> </pre>
<?php /** * Created by PhpStorm. * User: Stepan * Date: 10.02.2016 * Time: 22:23 */ require 'config.php'; require 'menu.php'; use StepanSib\AlmClient\AlmClient; use StepanSib\AlmClient\AlmEntity; use StepanSib\AlmClient\AlmEntityManager; $almClient = new AlmClient($connectionParams); $defects = $almClient->getManager()->getBy(AlmEntityManager::ENTITY_TYPE_DEFECT, array('id' => '=' . $defectId)); foreach ($defects as $defect) { // You can access entity field by getParameter method echo $defect->getParameter('id') . '<br/>'; // or by magic method echo $defect->id . '<hr/>'; // or simply iterate through all of the fields foreach ($defect->getParameters() as $field => $value) { echo $field . ': ' . $value . '<br/>'; } echo '<hr/>'; }
<?php /** * Created by PhpStorm. * User: Stepan * Date: 12.02.2016 * Time: 23:03 */ require 'config.php'; require 'menu.php'; use StepanSib\AlmClient\AlmClient; use StepanSib\AlmClient\AlmEntity; use StepanSib\AlmClient\AlmEntityManager; $almClient = new AlmClient($connectionParams); $entity = new AlmEntity(AlmEntityManager::ENTITY_TYPE_DEFECT); $entity->setParameter('name', 'REST API test defect ' . date('d/m/Y H:i:s'))->setParameter('detected-by', $connectionParams['username'])->setParameter('owner', $connectionParams['username'])->setParameter('creation-time', date('Y-m-d'))->setParameter('user-05', 'Не определен')->setParameter('description', 'REST API test defect description'); echo 'Entity created successfully<br/>'; $entity = $almClient->getManager()->save($entity); echo 'Save entity id: ' . $entity->id . '<br/>';
<?php /** * Created by PhpStorm. * User: Stepan * Date: 12.02.2016 * Time: 13:44 */ require 'config.php'; require 'header_xml.php'; use StepanSib\AlmClient\AlmClient; use StepanSib\AlmClient\AlmEntity; use StepanSib\AlmClient\AlmEntityManager; $almClient = new AlmClient($connectionParams); $defectsRawResponse = $almClient->getManager()->getBy(AlmEntityManager::ENTITY_TYPE_DEFECT, array('id' => '=' . $defectId), AlmEntityManager::HYDRATION_NONE); echo $defectsRawResponse;