PHP code example of worksolutions / bitrix-module-bunit
1. Go to this page and download the library: Download worksolutions/bitrix-module-bunit 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/ */
worksolutions / bitrix-module-bunit example snippets
class IblockAmountTestCase extends \WS\BUnit\Cases\BaseCase {
/**
* @test
*/
public function iblocksNotEmpty() {
CModule::IncludeModule("iblock");
$dbResult = CIBlock::getList(array(), array());
$this->getAssert()->asTrue($dbResult->AffectedRowsCount() > 0, "Число инфоблоков должно быть больше нуля");
}
/**
* @test
*/
public function hasNewsIblock() {
$result = CIBlock::getList(array(), array("CODE" => "news"))->fetch();
$this->getAssert()->asTrue((bool) $result, "Отсутствует инфоблок новостей");
}
}