3v4l.org

run code in 300+ PHP versions simultaneously
<?php class User { protected $name; protected $last_ip; public function __construct($name) { $this->name = $name; } public function setLastIp($ip) { $this->last_ip = $ip; } public function getLastIp() { return $this->last_ip; } } interface EntityManagerInterface { public function persist($entity); public function flush($entity = null); } interface UserManagerInterface { public function recordLogin(User $user,$ip); } class UserManagerTest extends PHPUnit_test_case { public function testRecordLogin() { $entity_manager = $this->getMockBuilder('EntityManagerInterface') ->expects($this->method('persist'))->once() ->expects($this->method('flush'))->once(); $test_user = new User('User name'); $test_ip = '127.111.111.111'; $test_manager = new UserManager($entity_manager); $test_manager->recordLogin($test_user, $test_ip); $this->assertEquals($test_ip, $test_user->getLastIp()); } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Nn76d
function name:  (null)
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   42     0  E >   DECLARE_CLASS                                            'usermanagertest', 'phpunit_test_case'
   60     1      > RETURN                                                   1

Class User:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Nn76d
function name:  __construct
number of ops:  4
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
   11     1        ASSIGN_OBJ                                               'name'
          2        OP_DATA                                                  !0
   12     3      > RETURN                                                   null

End of function __construct

Function setlastip:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Nn76d
function name:  setLastIp
number of ops:  4
compiled vars:  !0 = $ip
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
   16     1        ASSIGN_OBJ                                               'last_ip'
          2        OP_DATA                                                  !0
   17     3      > RETURN                                                   null

End of function setlastip

Function getlastip:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Nn76d
function name:  getLastIp
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   FETCH_OBJ_R                                      ~0      'last_ip'
          1      > RETURN                                                   ~0
   22     2*     > RETURN                                                   null

End of function getlastip

End of class User.

Class EntityManagerInterface:
Function persist:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Nn76d
function name:  persist
number of ops:  2
compiled vars:  !0 = $entity
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   29     0  E >   RECV                                             !0      
          1      > RETURN                                                   null

End of function persist

Function flush:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Nn76d
function name:  flush
number of ops:  2
compiled vars:  !0 = $entity
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   31     0  E >   RECV_INIT                                        !0      null
          1      > RETURN                                                   null

End of function flush

End of class EntityManagerInterface.

Class UserManagerInterface:
Function recordlogin:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Nn76d
function name:  recordLogin
number of ops:  3
compiled vars:  !0 = $user, !1 = $ip
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   38     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2      > RETURN                                                   null

End of function recordlogin

End of class UserManagerInterface.

Class UserManagerTest:
Function testrecordlogin:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Nn76d
function name:  testRecordLogin
number of ops:  40
compiled vars:  !0 = $entity_manager, !1 = $test_user, !2 = $test_ip, !3 = $test_manager
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   47     0  E >   INIT_METHOD_CALL                                         'getMockBuilder'
          1        SEND_VAL_EX                                              'EntityManagerInterface'
          2        DO_FCALL                                      0  $4      
   48     3        INIT_METHOD_CALL                                         $4, 'expects'
          4        INIT_METHOD_CALL                                         'method'
          5        SEND_VAL_EX                                              'persist'
          6        DO_FCALL                                      0  $5      
          7        SEND_VAR_NO_REF_EX                                       $5
          8        DO_FCALL                                      0  $6      
          9        INIT_METHOD_CALL                                         $6, 'once'
         10        DO_FCALL                                      0  $7      
   49    11        INIT_METHOD_CALL                                         $7, 'expects'
         12        INIT_METHOD_CALL                                         'method'
         13        SEND_VAL_EX                                              'flush'
         14        DO_FCALL                                      0  $8      
         15        SEND_VAR_NO_REF_EX                                       $8
         16        DO_FCALL                                      0  $9      
         17        INIT_METHOD_CALL                                         $9, 'once'
         18        DO_FCALL                                      0  $10     
   47    19        ASSIGN                                                   !0, $10
   51    20        NEW                                              $12     'User'
         21        SEND_VAL_EX                                              'User+name'
         22        DO_FCALL                                      0          
         23        ASSIGN                                                   !1, $12
   52    24        ASSIGN                                                   !2, '127.111.111.111'
   54    25        NEW                                              $16     'UserManager'
         26        SEND_VAR_EX                                              !0
         27        DO_FCALL                                      0          
         28        ASSIGN                                                   !3, $16
   55    29        INIT_METHOD_CALL                                         !3, 'recordLogin'
         30        SEND_VAR_EX                                              !1
         31        SEND_VAR_EX                                              !2
         32        DO_FCALL                                      0          
   57    33        INIT_METHOD_CALL                                         'assertEquals'
         34        SEND_VAR_EX                                              !2
         35        INIT_METHOD_CALL                                         !1, 'getLastIp'
         36        DO_FCALL                                      0  $20     
         37        SEND_VAR_NO_REF_EX                                       $20
         38        DO_FCALL                                      0          
   58    39      > RETURN                                                   null

End of function testrecordlogin

End of class UserManagerTest.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.68 ms | 1403 KiB | 13 Q