Skip to content

Commit

Permalink
BitrixExceptionAssertTrait. Ассерт на битриксовое исключение (по текс…
Browse files Browse the repository at this point in the history
…ту).
  • Loading branch information
ProklUng committed Apr 26, 2021
1 parent df716cc commit cda6520
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/Traits/BitrixExceptionAssertTrait.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

namespace Prokl\BitrixTestingTools\Traits;

/**
* Trait BitrixExceptionAssertTrait
* @package Prokl\BitrixTestingTools\Traits
*
* @since 26.04.2021
*/
trait BitrixExceptionAssertTrait
{
/**
* Ассерт на битриксовое исключение (по тексту).
*
* @param string $message Сообщение в битриксовом исключении.
*
* @return void
*/
protected function willExpectBitrixExceptionMessage(string $message) : void
{
$exceptionText = $GLOBALS['APPLICATION']->GetException();

$this->assertSame(
$message,
$exceptionText->GetString()
);
}
}

0 comments on commit cda6520

Please sign in to comment.