How to use Anything class

Best AspectMock code snippet using Anything

sticky-menu-or-anything.php

Source:sticky-menu-or-anything.php Github

copy

Full Screen

1<?php2/*3Plugin Name: Sticky Menu (or Anything!) on Scroll4Plugin URI: http://www.senff.com/plugins/sticky-anything-wp5Description: Pick any element on your page, and it will stick when it reaches the top of the page when you scroll down. Usually handy for navigation menus, but can be used for any (unique) element on your page.6Author: Mark Senff7Author URI: http://www.senff.com8Version: 1.3.19*/10defined('ABSPATH') or die('INSERT COIN');11/**12 * === FUNCTIONS ========================================================================================13 */14/**15 * --- IF DATABASE VALUES ARE NOT SET AT ALL, ADD DEFAULT OPTIONS TO DATABASE ---------------------------16 */17if (!function_exists('sticky_anthing_default_options')) {18 function sticky_anthing_default_options() {19 $versionNum = '1.3.1';20 if (get_option('sticky_anything_options') === false) {21 $new_options['sa_version'] = $versionNum;22 $new_options['sa_element'] = '';23 $new_options['sa_topspace'] = '';24 $new_options['sa_adminbar'] = true;25 $new_options['sa_minscreenwidth'] = ''; 26 $new_options['sa_maxscreenwidth'] = ''; 27 $new_options['sa_zindex'] = '';28 $new_options['sa_dynamicmode'] = false; 29 $new_options['sa_debugmode'] = false;30 $new_options['sa_pushup'] = '';31 add_option('sticky_anything_options',$new_options);32 } 33 }34}35/**36 * --- IF DATABASE VALUES EXIST, CHECK IF NEWER OPTIONS EXIST ------------------------------------------37 * --- IF NOT, ADD THESE OPTIONS WITH DEFAULT VALUES ---------------------------------------------------38 * --- AND UPDATE VERSION NUMBER FOR SURE --------------------------------------------------------------39 */40if (!function_exists('sticky_anything_update')) {41 function sticky_anything_update() {42 $versionNum = '1.3.1';43 $existing_options = get_option('sticky_anything_options');44 if(!isset($existing_options['sa_minscreenwidth'])) {45 // Introduced in version 1.146 $existing_options['sa_minscreenwidth'] = '';47 $existing_options['sa_maxscreenwidth'] = '';48 } 49 if(!isset($existing_options['sa_dynamicmode'])) {50 // Introduced in version 1.251 $existing_options['sa_dynamicmode'] = false;52 } 53 if(!isset($existing_options['sa_pushup'])) {54 // Introduced in version 1.355 $existing_options['sa_pushup'] = '';56 $existing_options['sa_adminbar'] = true;57 } 58 $existing_options['sa_version'] = $versionNum;59 update_option('sticky_anything_options',$existing_options);60 }61}62/**63 * --- LOAD MAIN .JS FILE AND CALL IT WITH PARAMETERS (BASED ON DATABASE VALUES) -----------------------64 */65if (!function_exists('load_sticky_anything')) {66 function load_sticky_anything() {67 $options = get_option('sticky_anything_options');68 $versionNum = $options['sa_version'];69 // Main jQuery plugin file 70 wp_register_script('stickyAnythingLib', plugins_url('/assets/js/jq-sticky-anything.min.js', __FILE__), array( 'jquery' ), $versionNum);71 wp_enqueue_script('stickyAnythingLib');72 $options = get_option('sticky_anything_options');73 // Set defaults for by-default-empty elements (because '' does not work with the JQ plugin) 74 if (!$options['sa_topspace']) {75 $options['sa_topspace'] = '0';76 }77 if (!$options['sa_minscreenwidth']) {78 $options['sa_minscreenwidth'] = '0';79 }80 if (!$options['sa_maxscreenwidth']) {81 $options['sa_maxscreenwidth'] = '999999';82 }83 // If empty, set to 1 - not to 0. Also, if set to "0", keep it at 0.84 if (strlen($options['sa_zindex']) == "0") {85 $options['sa_zindex'] = '1';86 }87 $script_vars = array(88 'element' => $options['sa_element'],89 'topspace' => $options['sa_topspace'],90 'minscreenwidth' => $options['sa_minscreenwidth'],91 'maxscreenwidth' => $options['sa_maxscreenwidth'],92 'zindex' => $options['sa_zindex'],93 'dynamicmode' => $options['sa_dynamicmode'],94 'debugmode' => $options['sa_debugmode'],95 'pushup' => $options['sa_pushup'],96 'adminbar' => $options['sa_adminbar']97 );98 wp_enqueue_script('stickThis', plugins_url('/assets/js/stickThis.js', __FILE__), array( 'jquery' ), $versionNum, true);99 wp_localize_script( 'stickThis', 'sticky_anything_engage', $script_vars );100 }101}102/**103 * --- ADD LINK TO SETTINGS PAGE TO SIDEBAR ------------------------------------------------------------104 */105if (!function_exists('sticky_anything_menu')) {106 function sticky_anything_menu() {107 add_options_page( 'Sticky Menu (or Anything!) Configuration', 'Sticky Menu (or Anything!)', 'manage_options', 'stickyanythingmenu', 'sticky_anything_config_page' );108 }109}110/**111 * --- ADD LINK TO SETTINGS PAGE TO PLUGIN ------------------------------------------------------------112 */113if (!function_exists('sticky_anything_settings_link')) {114function sticky_anything_settings_link($links) { 115 $settings_link = '<a href="options-general.php?page=stickyanythingmenu">Settings</a>'; 116 array_unshift($links, $settings_link); 117 return $links; 118}119}120/**121 * --- THE WHOLE ADMIN SETTINGS PAGE -------------------------------------------------------------------122 */123if (!function_exists('sticky_anything_config_page')) {124 function sticky_anything_config_page() {125 // Retrieve plugin configuration options from database126 $sticky_anything_options = get_option( 'sticky_anything_options' );127 ?>128 <div id="sticky-anything-settings-general" class="wrap">129 <h2><?php _e('Sticky Menu (or Anything!) Settings','Sticky Anything plugin'); ?></h2>130 <p><?php _e('Pick any element on your page, and it will stick when it reaches the top of the page when you scroll down. Usually handy for navigation menus, but can be used for any (unique) element on your page.','Sticky Anything plugin'); ?></p>131 <div class="main-content">132 <h2 class="nav-tab-wrapper"> 133 <a class="nav-tab" href="#main"><?php _e('Settings','Sticky Anything plugin'); ?></a>134 <a class="nav-tab" href="#faq"><?php _e('FAQ/Troubleshooting','Sticky Anything plugin'); ?></a>135 </h2>136 <br>137 <?php 138 $warnings = false;139 if ( isset( $_GET['message'] )) { 140 if ($_GET['message'] == '1') {141 echo '<div id="message" class="fade updated"><p><strong>'.__('Settings Updated.','Sticky Anything plugin').'</strong></p></div>';142 }143 } 144 145 if ( isset( $_GET['message'] )) { 146 if ($sticky_anything_options['sa_element'] == '') {147 $warnings = true; 148 }149 }150 if ( (!is_numeric($sticky_anything_options['sa_topspace'])) && ($sticky_anything_options['sa_topspace'] != '')) {151 // Top space is not empty and has bad value152 $warnings = true;153 }154 if ( (!is_numeric($sticky_anything_options['sa_minscreenwidth'])) && ($sticky_anything_options['sa_minscreenwidth'] != '')) {155 // Minimum width is not empty and has bad value156 $warnings = true;157 }158 if ( (!is_numeric($sticky_anything_options['sa_maxscreenwidth'])) && ($sticky_anything_options['sa_maxscreenwidth'] != '')) {159 // Maximum width is not empty and has bad value160 $warnings = true;161 }162 if ( ($sticky_anything_options['sa_minscreenwidth'] != '') && ($sticky_anything_options['sa_maxscreenwidth'] != '') && ( ($sticky_anything_options['sa_minscreenwidth']) >= ($sticky_anything_options['sa_maxscreenwidth']) ) ) {163 // Minimum width is larger than the maximum width164 $warnings = true;165 }166 if ((!is_numeric($sticky_anything_options['sa_zindex'])) && ($sticky_anything_options['sa_zindex'] != '')) {167 // Z-index is not empty and has bad value168 $warnings = true;169 }170 // IF THERE ARE ERRORS, SHOW THEM171 if ( $warnings == true ) { 172 echo '<div id="message" class="error"><p><strong>'.__('Please review the current settings:','Sticky Anything plugin').'</strong></p>';173 echo '<ul style="list-style-type:disc; margin:0 0 20px 24px;">';174 if ($sticky_anything_options['sa_element'] == '') {175 echo '<li>'.__('ELEMENT is a required field. If you do not want anything sticky, consider disabling the plugin.','Sticky Anything plugin').'</li>';176 } 177 if ( (!is_numeric($sticky_anything_options['sa_topspace'])) && ($sticky_anything_options['sa_topspace'] != '')) {178 echo '<li>'.__('TOP POSITION has to be a number (do not include "px" or "pixels", or any other characters).','Sticky Anything plugin').'</li>';179 }180 if ( (!is_numeric($sticky_anything_options['sa_minscreenwidth'])) && ($sticky_anything_options['sa_minscreenwidth'] != '')) {181 echo '<li>'.__('MINIMUM SCREEN WIDTH has to be a number (do not include "px" or "pixels", or any other characters).','Sticky Anything plugin').'</li>';182 }183 if ( (!is_numeric($sticky_anything_options['sa_maxscreenwidth'])) && ($sticky_anything_options['sa_maxscreenwidth'] != '')) {184 echo '<li>'.__('MAXIMUM SCREEN WIDTH has to be a number (do not include "px" or "pixels", or any other characters).','Sticky Anything plugin').'</li>';185 }186 if ( ($sticky_anything_options['sa_minscreenwidth'] != '') && ($sticky_anything_options['sa_maxscreenwidth'] != '') && ( ($sticky_anything_options['sa_minscreenwidth']) >= ($sticky_anything_options['sa_maxscreenwidth']) ) ) {187 echo '<li>'.__('MAXIMUM screen width has to have a larger value than the MINIMUM screen width.','Sticky Anything plugin').'</li>';188 }189 if ((!is_numeric($sticky_anything_options['sa_zindex'])) && ($sticky_anything_options['sa_zindex'] != '')) {190 echo '<li>'.__('Z-INDEX has to be a number (do not include any other characters).','Sticky Anything plugin').'</li>';191 }192 echo '</ul></div>';193 } 194 ?>195 196 <div class="tabs-content">197 <div id="sticky-main">198 <form method="post" action="admin-post.php">199 <input type="hidden" name="action" value="save_sticky_anything_options" />200 <!-- Adding security through hidden referrer field -->201 <?php wp_nonce_field( 'sticky_anything' ); ?>202 <table class="form-table">203 <tr>204 <th scope="row"><?php _e('Sticky Element:','Sticky Anything plugin'); ?> <span class="required">*</span> <a href="#" title="<?php _e('The element that needs to be sticky once you scroll. This can be your menu, or any other element like a sidebar, ad banner, etc. Make sure this is a unique identifier.','Sticky Anything plugin'); ?>" class="help">?</a></th>205 <td>206 <input type="text" id="sa_element" name="sa_element" value="<?php 207 if ($sticky_anything_options['sa_element'] != '#NO-ELEMENT') {208 echo esc_html( $sticky_anything_options['sa_element'] ); 209 }210 ?>"/> <em><?php _e('(choose ONE element, e.g. #main-navigation, OR .main-menu-1, OR header nav, etc.)','Sticky Anything plugin'); ?></em>211 </td>212 </tr>213 <tr>214 <th scope="row"><?php _e('Space between top of page and sticky element: (optional)','Sticky Anything plugin'); ?> <a href="#" title="<?php _e('If you don\'t want the element to be sticky at the very top of the page, but a little lower, add the number of pixels that should be between your element and the \'ceiling\' of the page.','Sticky Anything plugin'); ?>" class="help">?</a></th>215 <td>216 <input type="number" id="sa_topspace" name="sa_topspace" value="<?php echo esc_html( $sticky_anything_options['sa_topspace'] ); ?>" style="width:80px;" /> pixels217 </td>218 </tr>219 <tr class="new-feature">220 <th scope="row"><span class="new"><?php _e('NEW!','Sticky Anything plugin'); ?></span> <?php _e('Check for Admin Toolbar:','Sticky Anything plugin'); ?> <a href="#" title="<?php _e('If the sticky element gets obscured by the Administrator Toolbar for logged in users (or vice versa), check this box.','Sticky Anything plugin'); ?>" class="help">?</a></th>221 <td>222 <input type="checkbox" id="sa_adminbar" name="sa_adminbar" <?php if ($sticky_anything_options['sa_adminbar'] ) echo ' checked="checked" ';?> />223 <label for="sa_adminbar"><strong><?php _e('Move the sticky element down a little if there is an Administrator Toolbar at the top (for logged in users).','Sticky Anything plugin'); ?></strong></label>224 </td>225 </tr>226 <tr>227 <th scope="row"><?php _e('Do not stick element when screen smaller than: (optional)','Sticky Anything plugin'); ?> <a href="#" title="<?php _e('Sometimes you do not want your element to be sticky when your screen is small (responsive menus, etc). If you enter a value here, your menu will not be sticky when your screen width is smaller than his value.','Sticky Anything plugin'); ?>" class="help">?</a></th>228 <td>229 <input type="number" id="sa_minscreenwidth" name="sa_minscreenwidth" value="<?php echo esc_html( $sticky_anything_options['sa_minscreenwidth'] ); ?>" style="width:80px;" /> pixels230 </td>231 </tr>232 <tr>233 <th scope="row"><?php _e('Do not stick element when screen larger than: (optional)','Sticky Anything plugin'); ?> <a href="#" title="<?php _e('Sometimes you do not want your element to be sticky when your screen is large (responsive menus, etc). If you enter a value here, your menu will not be sticky when your screen width is wider than this value.','Sticky Anything plugin'); ?>" class="help">?</a></th>234 <td>235 <input type="number" id="sa_maxscreenwidth" name="sa_maxscreenwidth" value="<?php echo esc_html( $sticky_anything_options['sa_maxscreenwidth'] ); ?>" style="width:80px;" /> pixels236 </td>237 </tr>238 <tr>239 <th scope="row"><?php _e('Z-index: (optional)','Sticky Anything plugin'); ?> <a href="#" title="<?php _e('If there are other elements on the page that obscure/overlap the sticky element, adding a Z-index might help. If you have no idea what that means, try entering 99999.','Sticky Anything plugin'); ?>" class="help">?</a></th>240 <td>241 <input type="number" id="sa_zindex" name="sa_zindex" value="<?php echo esc_html( $sticky_anything_options['sa_zindex'] ); ?>" style="width:80px;" />242 </td>243 </tr>244 <tr class="new-feature">245 <th scope="row"><span class="new"><?php _e('NEW!','Sticky Anything plugin'); ?></span> <?php _e('Push-up element (optional):','Sticky Anything plugin'); ?> <a href="#" title="<?php _e('If you want your sticky element to be \'pushed up\' again by another element lower on the page, enter it here. Make sure this is a unique identifier.','Sticky Anything plugin'); ?>" class="help">?</a></th>246 <td>247 <input type="text" id="sa_pushup" name="sa_pushup" value="<?php 248 if ($sticky_anything_options['sa_pushup'] != '#NO-ELEMENT') {249 echo esc_html( $sticky_anything_options['sa_pushup'] ); 250 }251 ?>"/> <em><?php _e('(choose ONE element, e.g. #footer, OR .widget-bottom, etc.)','Sticky Anything plugin'); ?></em>252 </td>253 </tr>254 <tr>255 <th scope="row"><?php _e('Dynamic mode:','Sticky Anything plugin'); ?> <a href="#" title="<?php _e('When Dynamic Mode is OFF, a cloned element will be created upon page load. If this mode is ON, a cloned element will be created every time your scrolled position hits the \'sticky\' point.','Sticky Anything plugin'); ?>" class="help">?</a></th>256 <td>257 <input type="checkbox" id="sa_dynamicmode" name="sa_dynamicmode" <?php if ($sticky_anything_options['sa_dynamicmode'] ) echo ' checked="checked" ';?> />258 <label for="sa_dynamicmode"><strong><?php _e('If the plugin doesn\'t work in your theme (often the case with responsive themes), try it in Dynamic Mode.','Sticky Anything plugin'); ?></strong></label>259 <p class="description"><?php _e('NOTE: this is not a \'Magic Checkbox\' that fixes all problems. It simply solves some issues that frequently appear with some responsive themes, but doesn\'t necessarily work in ALL situations.','Sticky Anything plugin'); ?></p>260 </td>261 </tr>262 <tr>263 <th scope="row"><?php _e('Debug mode:','Sticky Anything plugin'); ?> <a href="#" title="<?php _e('When Debug Mode is on, error messages will be shown in your browser\'s console when the element you selected either doesn\'t exist, or when there are more elements on the page with your chosen selector.','Sticky Anything plugin'); ?>" class="help">?</a></th>264 <td>265 <input type="checkbox" id="sa_debugmode" name="sa_debugmode" <?php if ($sticky_anything_options['sa_debugmode'] ) echo ' checked="checked" ';?> />266 <label for="sa_debugmode"><strong><?php _e('Log plugin errors in browser console','Sticky Anything plugin'); ?></strong></label>267 <p class="description"><?php _e('Do NOT check this option in production environments.','Sticky Anything plugin'); ?></p>268 </td>269 </tr>270 </table>271 <input type="submit" value="<?php _e('SAVE SETTINGS','Sticky Anything plugin'); ?>" class="button-primary"/>272 <p>&nbsp;</p>273 </form>274 </div>275 <div id="sticky-faq">276 <?php include 'assets/faq.php'; ?>277 </div>278 </div>279 </div>280 <div class="main-sidebar"> 281 <?php include 'assets/plugin-info.php'; ?>282 </div>283 </div>284 <?php285 }286}287if (!function_exists('sticky_anything_admin_init')) {288 function sticky_anything_admin_init() {289 add_action( 'admin_post_save_sticky_anything_options', 'process_sticky_anything_options' );290 }291}292/**293 * --- PROCESS THE SETTINGS FORM AFTER SUBMITTING ------------------------------------------------------294 */295if (!function_exists('process_sticky_anything_options')) {296 function process_sticky_anything_options() {297 if ( !current_user_can( 'manage_options' ))298 wp_die( 'Not allowed');299 check_admin_referer('sticky_anything');300 $options = get_option('sticky_anything_options');301 foreach ( array('sa_element') as $option_name ) {302 if ( isset( $_POST[$option_name] ) ) {303 $options[$option_name] = sanitize_text_field( $_POST[$option_name] );304 } 305 }306 foreach ( array('sa_topspace') as $option_name ) {307 if ( isset( $_POST[$option_name] ) ) {308 $options[$option_name] = sanitize_text_field( $_POST[$option_name] );309 }310 }311 foreach ( array('sa_minscreenwidth') as $option_name ) {312 if ( isset( $_POST[$option_name] ) ) {313 $options[$option_name] = sanitize_text_field( $_POST[$option_name] );314 }315 }316 foreach ( array('sa_maxscreenwidth') as $option_name ) {317 if ( isset( $_POST[$option_name] ) ) {318 $options[$option_name] = sanitize_text_field( $_POST[$option_name] );319 }320 }321 foreach ( array('sa_zindex') as $option_name ) {322 if ( isset( $_POST[$option_name] ) ) {323 $options[$option_name] = sanitize_text_field( $_POST[$option_name] );324 }325 }326 foreach ( array('sa_pushup') as $option_name ) {327 if ( isset( $_POST[$option_name] ) ) {328 $options[$option_name] = sanitize_text_field( $_POST[$option_name] );329 } 330 }331 foreach ( array('sa_adminbar') as $option_name ) {332 if ( isset( $_POST[$option_name] ) ) {333 $options[$option_name] = true;334 } else {335 $options[$option_name] = false;336 }337 }338 foreach ( array('sa_dynamicmode') as $option_name ) {339 if ( isset( $_POST[$option_name] ) ) {340 $options[$option_name] = true;341 } else {342 $options[$option_name] = false;343 }344 }345 foreach ( array('sa_debugmode') as $option_name ) {346 if ( isset( $_POST[$option_name] ) ) {347 $options[$option_name] = true;348 } else {349 $options[$option_name] = false;350 }351 }352 update_option( 'sticky_anything_options', $options ); 353 wp_redirect( add_query_arg(354 array('page' => 'stickyanythingmenu', 'message' => '1'),355 admin_url( 'options-general.php' ) 356 )357 ); 358 exit;359 }360}361/**362 * --- ADD THE .CSS AND .JS TO ADMIN MENU --------------------------------------------------------------363 */364if (!function_exists('sticky_anything_styles')) {365 function sticky_anything_styles($hook) {366 if ($hook != 'settings_page_stickyanythingmenu') {367 return;368 }369 wp_register_script('stickyAnythingAdminScript', plugins_url('/assets/js/sticky-anything-admin.js', __FILE__), array( 'jquery' ), '1.0');370 wp_enqueue_script('stickyAnythingAdminScript');371 wp_register_style('stickyAnythingAdminStyle', plugins_url('/assets/css/sticky-anything-admin.css', __FILE__) );372 wp_enqueue_style('stickyAnythingAdminStyle'); 373 }374}375/**376 * === HOOKS AND ACTIONS AND FILTERS AND SUCH ==========================================================377 */378$plugin = plugin_basename(__FILE__); 379register_activation_hook( __FILE__, 'sticky_anthing_default_options' );380add_action('init','sticky_anything_update',1);381add_action('wp_enqueue_scripts', 'load_sticky_anything');382add_action('admin_menu', 'sticky_anything_menu');383add_action('admin_init', 'sticky_anything_admin_init' );384add_action('admin_enqueue_scripts', 'sticky_anything_styles' );385add_filter("plugin_action_links_$plugin", 'sticky_anything_settings_link' );...

Full Screen

Full Screen

boot.php

Source:boot.php Github

copy

Full Screen

1<?php if (! defined('ABSPATH')) exit; // Exit if accessed directly2class SH4_App_Boot3{4 public function __construct(5 HC3_Dic $dic,6 HC3_Settings $settings,7 HC3_Ui_Topmenu $topmenu,8 HC3_Router $router,9 HC3_Acl $acl,1011 SH4_App_Migration $migration12 )13 {14 $migration->up();1516 $dic->bind( 'SH4_Permission', 'HC3_IPermission' );1718 $settings19 ->init( 'datetime_date_format', 'j M Y' )20 ->init( 'datetime_time_format', 'g:ia' )21 ->init( 'datetime_week_starts', 0 )22 ->init( 'datetime_timezone', '' )23 ->init( 'full_day_count_as', 8*60*60 )2425 ->init( 'skip_weekdays', array() )2627 ->init( 'datetime_min_time', 0 )28 ->init( 'datetime_max_time', 24*60*60 )29 ->init( 'datetime_step', 5*60 )3031 ->init( 'datetime_hide_schedule_reports', 0 )32 ->init( 'conflicts_calendar_only', 0 )33 ->init( 'shifts_no_draft', 0 )34 ;3536 $topmenu37 ->addAfter( NULL, 'profile', array('user/profile', '__Profile__') )38 ->addBefore( 'profile', 'admin', array('admin', '__Administration__') )39 ;4041 $router42 ->register( 'get:admin', array('SH4_App_Html_View_Admin', 'render') )4344 ->register( 'get:admin/about', array('SH4_App_Html_View_Admin_About', 'render') )4546 ->register( 'post:admin/reinstall', array('SH4_App_Html_Controller_Admin_Reinstall', 'execute') )47 ->register( 'post:admin/reinstall/shifts', array('SH4_App_Html_Controller_Admin_Reinstall', 'executeShifts') )48 ;4950 $acl51 ->register( 'get:admin', array('SH4_App_Acl', 'checkAdmin') )52 ->register( 'get:admin/{anything}', array('SH4_App_Acl', 'checkAdmin') )53 ->register( 'post:admin/{anything}', array('SH4_App_Acl', 'checkAdmin') )54 ->register( 'get:admin/{anything}/{anything}', array('SH4_App_Acl', 'checkAdmin') )55 ->register( 'post:admin/{anything}/{anything}', array('SH4_App_Acl', 'checkAdmin') )5657 ->register( 'get:manager', array('SH4_App_Acl', 'checkManager') )58 ->register( 'get:manager/{anything}', array('SH4_App_Acl', 'checkManager') )59 ->register( 'post:manager/{anything}', array('SH4_App_Acl', 'checkManager') )60 ->register( 'get:manager/{anything}/{anything}', array('SH4_App_Acl', 'checkManager') )61 ->register( 'post:manager/{anything}/{anything}', array('SH4_App_Acl', 'checkManager') )6263 ->register( 'get:employee', array('SH4_App_Acl', 'checkEmployee') )64 ->register( 'get:employee/{anything}', array('SH4_App_Acl', 'checkEmployee') )65 ->register( 'post:employee/{anything}', array('SH4_App_Acl', 'checkEmployee') )66 ->register( 'get:employee/{anything}/{anything}', array('SH4_App_Acl', 'checkEmployee') )67 ->register( 'post:employee/{anything}/{anything}', array('SH4_App_Acl', 'checkEmployee') )6869 ->register( 'get:user', array('SH4_App_Acl', 'checkUser') )70 ->register( 'get:user/{anything}', array('SH4_App_Acl', 'checkUser') )71 ->register( 'post:user/{anything}', array('SH4_App_Acl', 'checkUser') )72 ->register( 'get:user/{anything}/{anything}', array('SH4_App_Acl', 'checkUser') )73 ->register( 'post:user/{anything}/{anything}', array('SH4_App_Acl', 'checkUser') )74 ;75 } ...

Full Screen

Full Screen

IsAnythingTest.php

Source:IsAnythingTest.php Github

copy

Full Screen

1<?php2namespace Hamcrest\Core;3class IsAnythingTest extends \Hamcrest\AbstractMatcherTest4{5 protected function createMatcher()6 {7 return \Hamcrest\Core\IsAnything::anything();8 }9 public function testAlwaysEvaluatesToTrue()10 {11 assertThat(null, anything());12 assertThat(new \stdClass(), anything());13 assertThat('hi', anything());14 }15 public function testHasUsefulDefaultDescription()16 {17 $this->assertDescription('ANYTHING', anything());18 }19 public function testCanOverrideDescription()20 {21 $description = 'description';...

Full Screen

Full Screen

Anything

Using AI Code Generation

copy

Full Screen

1$anything = new \AspectMock\Test::Anything();2$anything = new \AspectMock\Test::Anything();3use AspectMock\Test as Anything;4$anything = new Anything::Anything();5$anything = new Anything::Anything();6$anything = new Anything::Anything();7I am getting the following error: Parse error: syntax error, unexpected 'Anything' (T_STRING) in 3.php on line 3

Full Screen

Full Screen

Anything

Using AI Code Generation

copy

Full Screen

1$anything = new AspectMock\Anything();2$anything = new \AspectMock\Anything();3$anything = new \AspectMock\Anything();4$anything = new AspectMock\Anything();5$anything = new AspectMock\Anything();6$anything = new \AspectMock\Anything();7$anything = new \AspectMock\Anything();8$anything = new AspectMock\Anything();9$anything = new \AspectMock\Anything();10$anything = new AspectMock\Anything();11$anything = new \AspectMock\Anything();12$anything = new AspectMock\Anything();13$anything = new \AspectMock\Anything();14$anything = new AspectMock\Anything();15$anything = new \AspectMock\Anything();16$anything = new AspectMock\Anything();17$anything = new \AspectMock\Anything();18$anything = new AspectMock\Anything();19$anything = new \AspectMock\Anything();20$anything = new AspectMock\Anything();21$anything = new \AspectMock\Anything();22$anything = new AspectMock\Anything();

Full Screen

Full Screen

Anything

Using AI Code Generation

copy

Full Screen

1$anything = AspectMock::func('Anything', 'anything', true);2$anything->verifyInvoked([1,2,3]);3$anything = AspectMock::func('Anything', 'anything', true);4$anything->verifyInvoked([1,2,3]);5Mockery\Exception\InvalidCountException: Method anything([1, 2, 3]) from Mockery_1_Anything should be called6$anything = AspectMock::func('Anything', 'anything', true);7$anything->verifyInvoked([1,2,3]);8$anything->verifyInvoked([1,2,3]);9$kernel = \AspectMock\Kernel::getInstance();10$kernel->init([11]);

Full Screen

Full Screen

Anything

Using AI Code Generation

copy

Full Screen

1$anything = AspectMock::func('Anything');2$anything->getAnything()->returns('something');3$anything = AspectMock::func('Anything');4$anything->getAnything()->returns('something');5I am using AspectMock for unit testing my application. I am using it for mocking the functions of classes. I have a class called Anything which has a function called getAnything() which returns some value. I am using this class in my application. I have two files 1.php and 2.php. I am using the class in both files. I want to mock the class in both files. I am doing the following:But when I run the test it gives me the following error: Fatal error: Cannot redeclare class AspectMock\Proxy\Anything in /var/www/html/aspectmock/src/AspectMock/Proxy/Anything.php on line 9I am using AspectMock for unit testing my application. I am using it for mocking the functions of classes. I have a class called Anything which has a function called getAnything() which returns some value. I am using this class in my application. I have two files 1.php and 2.php. I am using the class in both files. I want to mock the class in both files. I am doing the following:But when I run the test it gives me the following error: Fatal error: Cannot redeclare class AspectMock\Proxy\Anything in /var/www/html/aspectmock/src/AspectMock/Proxy/Anything.php on line 96I am using AspectMock for unit testing my application. I am using it for mocking the functions of classes. I have a class called Anything which has a function called getAnything() which returns some value. I am using this class in my application. I have two files 1.php and 2.php. I am using the class in both files. I want to mock the class in both files. I am doing the following:

Full Screen

Full Screen

Anything

Using AI Code Generation

copy

Full Screen

1$mock = AspectMock::double('Anything', ['method' => 'new value']);2echo Anything::method();3$mock = AspectMock::double('Anything', ['method' => 'new value']);4echo Anything::method();5You can also use the AspectMock::double() method to return a different value for each call to a method. This is useful for testing methods that return a value based on some input. For example, if you have a method that returns a random number between 0 and 10, you can use the AspectMock::double() method to test that the method returns a number between 0 and 10. Here’s how you’d do it:6$mock = AspectMock::double('Anything', ['method' => 5]);7echo Anything::method();8$mock = AspectMock::double('Anything', ['method' => 5]);9echo Anything::method();10$mock = AspectMock::double('Anything', ['method' => 5]);11echo Anything::method();12Now, if you run the 3.php file, you’ll see the number 5. But, if you run the 2.php file, you’ll see the number 5. This is because the AspectMock::double() method returns a mock object that you can use to control the behavior of the class. In this case, we’ve told the mock object to return

Full Screen

Full Screen

Anything

Using AI Code Generation

copy

Full Screen

1use AspectMock\Test as test;2use Codeception\Util\Stub;3{4 public function test() {5 $mock = test::double('Anything', ['method1' => 'new return value']);6 $anything = new Anything();7 $this->assertEquals('new return value', $anything->method1());8 $mock->verifyInvoked('method1');9 }10}11{12 public function test() {13 $mock = test::double('Anything', ['method1' => 'new return value']);14 $anything = new Anything();15 $this->assertEquals('new return value', $anything->method1());16 $mock->verifyInvoked('method1');17 }18}19{20 public function test() {21 $mock = test::double('Anything', ['method1' => 'new return value']);22 $anything = new Anything();23 $this->assertEquals('new return value', $anything->method1());24 $mock->verifyInvoked('method1');25 }26}27{28 public function test() {29 $mock = test::double('Anything', ['method1' => 'new return value']);30 $anything = new Anything();31 $this->assertEquals('new return value', $anything->method1());32 $mock->verifyInvoked('method1');33 }34}35{36 public function test() {37 $mock = test::double('Anything', ['method1' => 'new return value']);38 $anything = new Anything();39 $this->assertEquals('new return value', $anything->method1());40 $mock->verifyInvoked('method1');41 }42}43use AspectMock\Test as test;44use Codeception\Util\Stub;45{46 public function test() {47 $mock = test::double('Anything', ['method1' => 'new return value']);

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run AspectMock automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Run Selenium Automation Tests on LambdaTest Cloud Grid

Trigger Selenium automation tests on a cloud-based Grid of 3000+ real browsers and operating systems.

Test now for Free

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful