本文整理汇总了PHP中Mock::whenAttr方法的典型用法代码示例。如果您正苦于以下问题:PHP Mock::whenAttr方法的具体用法?PHP Mock::whenAttr怎么用?PHP Mock::whenAttr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mock
的用法示例。
在下文中一共展示了Mock::whenAttr方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dirname
<?php
require_once "functions.php";
include "config.php";
include dirname(__FILE__) . "/../../../../wp-config.php";
require_once dirname(__FILE__) . "/../classes/WCAPI/includes.php";
$db = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
$db->set_charset(DB_CHARSET);
$mapper = new Mapper($db);
$Header("General Mapper Setup");
notEqual($mapper->connection, null);
shouldBeTypeOf($mapper->errors, 'array');
hasAtMost($mapper->details, 0);
equal($mapper->table_prefix, '');
$mapper->table_prefix = $table_prefix;
equal($mapper->table_prefix, $table_prefix);
equal($mapper->self, $mapper, '$self should equal $this');
$Header("Testing Create Functionality");
$old_self = $mapper;
$mock = new Mock();
$mock->whenAttr('table_prefix', 'mock_');
$mapper->setSelf($mock);
$model = new \WCAPI\Product();
$mapper->create($model, array());
$mock->hasReceived('table_prefix');