PHP code example of sheerockoff / bitrix-ci

1. Go to this page and download the library: Download sheerockoff/bitrix-ci library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

sheerockoff / bitrix-ci example snippets





putenv('MYSQL_HOST=localhost');
putenv('MYSQL_DATABASE=bitrix_ci');
putenv('MYSQL_USER=user');
putenv('MYSQL_PASSWORD=password');

\BitrixToolkit\BitrixCi\Bootstrap::migrate();

\BitrixToolkit\BitrixCi\Bootstrap::bootstrap();

/**
 * @param array $stack
 * @return array
 */
public function testCanGetBitrixElement(array $stack)
{
    $element = CIBlockElement::GetList(null, ['ID' => $stack['id']])->GetNextElement();
    $this->assertInstanceOf(_CIBElement::class, $element);
    
    $fields = $element->GetFields();
    $this->assertEquals($stack['id'], $fields['ID']);
    
    return $stack;
}