Kahlan\Spec\Fixture\Plugin\Monkey\Mon::time PHP Method

time() public method

public time ( )
    public function time()
    {
        return time();
    }

Usage Example

Esempio n. 1
0
  */
 afterAll(function () {
     Interceptor::load($this->previous);
 });
 it("patches a core function", function () {
     $mon = new Mon();
     Monkey::patch('time', 'Kahlan\\Spec\\Suite\\Plugin\\mytime');
     expect($mon->time())->toBe(245026800);
 });
 describe("::patch()", function () {
     it("patches a core function with a closure", function () {
         $mon = new Mon();
         Monkey::patch('time', function () {
             return 123;
         });
         expect($mon->time())->toBe(123);
     });
     it("patches a core class", function () {
         $mon = new Mon();
         Monkey::patch('DateTime', 'Kahlan\\Spec\\Mock\\Plugin\\Monkey\\MyDateTime');
         expect($mon->datetime()->getTimestamp())->toBe(245026800);
     });
     it("patches a core class using substitutes", function () {
         $mon = new Mon();
         $patch = Monkey::patch('DateTime');
         $patch->toBe(new DateTime('@123'), new DateTime('@456'));
         expect($mon->datetime()->getTimestamp())->toBe(123);
         expect($mon->datetime()->getTimestamp())->toBe(456);
     });
     it("patches a function", function () {
         $mon = new Mon();
All Usage Examples Of Kahlan\Spec\Fixture\Plugin\Monkey\Mon::time