redefineConstant() public static method

public static redefineConstant ( $constantName, $value )
コード例 #1
0
ファイル: SoftMocksExample.php プロジェクト: badoo/soft-mocks
 public static function applyMocks()
 {
     \QA\SoftMocks::redefineConstant('TEST_CONSTANT_WITH_VALUE_42', 43);
     \QA\SoftMocks::redefineConstant('\\Example::STATIC_DO_SMTH_RESULT', 'Example::STATIC_DO_SMTH_RESULT value changed');
     \QA\SoftMocks::redefineFunction('someFunc', '$a', 'return 55 + $a;');
     \QA\SoftMocks::redefineMethod(Example::class, 'doSmthStatic', '', 'return "Example::doSmthStatic() redefined";');
     \QA\SoftMocks::redefineMethod(Example::class, 'doSmthDynamic', '', 'return "Example->doSmthDynamic() redefined";');
 }
コード例 #2
0
ファイル: ExampleTest.php プロジェクト: badoo/soft-mocks
 public function testClassConstant()
 {
     \QA\SoftMocks::redefineConstant(self::class . '::EX_CLASS_CONST', 6);
     $this->assertEquals(6, self::EX_CLASS_CONST);
 }