MediaWiki REL1_32
PHPUnit4And6Compat.php
Go to the documentation of this file.
1<?php
24trait PHPUnit4And6Compat {
31 public function setExpectedException( $name, $message = '', $code = null ) {
32 if ( is_callable( [ $this, 'expectException' ] ) ) {
33 if ( $name !== null ) {
34 $this->expectException( $name );
35 }
36 if ( $message !== '' ) {
37 $this->expectExceptionMessage( $message );
38 }
39 if ( $code !== null ) {
40 $this->expectExceptionCode( $code );
41 }
42 } else {
43 parent::setExpectedException( $name, $message, $code );
44 }
45 }
46
52 public function getMock( $originalClassName, $methods = [], array $arguments = [],
53 $mockClassName = '', $callOriginalConstructor = true, $callOriginalClone = true,
54 $callAutoload = true, $cloneArguments = false, $callOriginalMethods = false,
55 $proxyTarget = null
56 ) {
57 if ( is_callable( 'parent::getMock' ) ) {
58 return parent::getMock(
59 $originalClassName, $methods, $arguments, $mockClassName,
60 $callOriginalConstructor, $callOriginalClone, $callAutoload,
61 $cloneArguments, $callOriginalMethods, $proxyTarget
62 );
63 } else {
64 $builder = $this->getMockBuilder( $originalClassName )
65 ->setMethods( $methods )
66 ->setConstructorArgs( $arguments )
67 ->setMockClassName( $mockClassName )
68 ->setProxyTarget( $proxyTarget );
69 if ( $callOriginalConstructor ) {
70 $builder->enableOriginalConstructor();
71 } else {
72 $builder->disableOriginalConstructor();
73 }
74 if ( $callOriginalClone ) {
75 $builder->enableOriginalClone();
76 } else {
77 $builder->disableOriginalClone();
78 }
79 if ( $callAutoload ) {
80 $builder->enableAutoload();
81 } else {
82 $builder->disableAutoload();
83 }
84 if ( $cloneArguments ) {
85 $builder->enableArgumentCloning();
86 } else {
87 $builder->disableArgumentCloning();
88 }
89 if ( $callOriginalMethods ) {
90 $builder->enableProxyingToOriginalMethods();
91 } else {
92 $builder->disableProxyingToOriginalMethods();
93 }
94
95 return $builder->getMock();
96 }
97 }
98
108 public function createMock( $originalClassName ) {
109 if ( is_callable( 'parent::createMock' ) ) {
110 return parent::createMock( $originalClassName );
111 }
112 // Compat for PHPUnit <= 5.4
113 return $this->getMockBuilder( $originalClassName )
114 ->disableOriginalConstructor()
115 ->disableOriginalClone()
116 ->disableArgumentCloning()
117 // New in phpunit-mock-objects 3.2 (phpunit 5.4.0)
118 // ->disallowMockingUnknownTypes()
119 ->getMock();
120 }
121}
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output modifiable & $code
Definition hooks.txt:895
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))