本文整理汇总了PHP中SimpleTestCompatibility::isA方法的典型用法代码示例。如果您正苦于以下问题:PHP SimpleTestCompatibility::isA方法的具体用法?PHP SimpleTestCompatibility::isA怎么用?PHP SimpleTestCompatibility::isA使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SimpleTestCompatibility
的用法示例。
在下文中一共展示了SimpleTestCompatibility::isA方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _isTest
function _isTest($method)
{
if (strtolower(substr($method, 0, 2)) == 'it' || strtolower(substr($method, 0, 6)) == 'should') {
return !SimpleTestCompatibility::isA($this, strtolower($method));
}
return false;
}
示例2: _isTest
/**
* Tests to see if the method is a test that should
* be run, override default by searching methods that starts with 'it'
* is a candidate unless it is the constructor.
* @param string $method Method name to try.
* @return boolean True if test method.
* @access protected
*/
function _isTest($method)
{
if (strtolower(substr($method, 0, 2)) == 'it') {
return !SimpleTestCompatibility::isA($this, strtolower($method));
}
return parent::_isTest($method);
}
示例3: testInteraceComparison
function testInteraceComparison()
{
if (version_compare(phpversion(), '5', '<')) {
return;
}
$object = new ComparisonClassWithInterface();
$this->assertFalse(SimpleTestCompatibility::isA(new ComparisonClass(), 'ComparisonInterface'));
$this->assertTrue(SimpleTestCompatibility::isA(new ComparisonClassWithInterface(), 'ComparisonInterface'));
}
示例4: testIsA
function testIsA() {
$this->assertTrue(SimpleTestCompatibility::isA(
new RandomCompatibilityClass(),
'RandomCompatibilityClass'));
$this->assertFalse(SimpleTestCompatibility::isA(
new RandomCompatibilityClass(),
'RandomCompatibilitySubclass'));
$this->assertTrue(SimpleTestCompatibility::isA(
new RandomCompatibilitySubclass(),
'RandomCompatibilityClass'));
}
示例5: _addCheckbox
/**
* Adds a checkbox, making it a group on a repeated name.
* @param SimpleCheckboxTag $tag Incoming form control.
* @access private
*/
function _addCheckbox($tag) {
if (! isset($this->_widgets[$tag->getName()])) {
$this->_widgets[$tag->getName()] = &$tag;
} elseif (! SimpleTestCompatibility::isA($this->_widgets[$tag->getName()], 'SimpleCheckboxGroup')) {
$previous = &$this->_widgets[$tag->getName()];
$this->_widgets[$tag->getName()] = &new SimpleCheckboxGroup();
$this->_widgets[$tag->getName()]->addWidget($previous);
$this->_widgets[$tag->getName()]->addWidget($tag);
} else {
$this->_widgets[$tag->getName()]->addWidget($tag);
}
}
示例6: _coerceExpectation
/**
* Creates an equality expectation if the
* object/value is not already some type
* of expectation.
* @param mixed $expected Expected value.
* @return SimpleExpectation Expectation object.
* @access private
*/
function _coerceExpectation($expected)
{
if ($expected == false) {
return new TrueExpectation();
}
if (SimpleTestCompatibility::isA($expected, 'SimpleExpectation')) {
return $expected;
}
return new EqualExpectation(is_string($expected) ? str_replace('%', '%%', $expected) : $expected);
}
示例7: _isTest
/**
* Tests to see if the method is a test that should
* be run. Currently any method that starts with 'test'
* is a candidate unless it is the constructor.
* @param string $method Method name to try.
* @return boolean True if test method.
* @access protected
*/
function _isTest($method) {
if (strtolower(substr($method, 0, 4)) == 'test') {
return ! SimpleTestCompatibility::isA($this, strtolower($method));
}
return false;
}
示例8: array
/**
* Retrieves 'preferred' objects from global pool. Class filter
* can be applied in order to retrieve the object of the specific
* class
* @param array|string $classes Allowed classes or interfaces.
* @static
* @access public
* @return array|object|null
* @see prefer()
*/
function &preferred($classes)
{
if (!is_array($classes)) {
$classes = array($classes);
}
$registry =& SimpleTest::_getRegistry();
for ($i = count($registry['Preferred']) - 1; $i >= 0; $i--) {
foreach ($classes as $class) {
if (SimpleTestCompatibility::isA($registry['Preferred'][$i], $class)) {
return $registry['Preferred'][$i];
}
}
}
return null;
}
示例9: _isConstructor
/**
* Tests to see if the method is the constructor and
* so should be ignored.
* @param string $method Method name to try.
* @return boolean True if constructor.
* @access protected
*/
function _isConstructor($method)
{
return SimpleTestCompatibility::isA($this->_test_case, strtolower($method));
}
示例10: test
/**
* Tests the expectation. True if the type or
* class matches the string value.
* @param string $compare Comparison value.
* @return boolean True if correct.
* @access public
*/
function test($compare)
{
if (is_object($compare)) {
return SimpleTestCompatibility::isA($compare, $this->type);
} else {
$function = 'is_' . $this->canonicalType($this->type);
if (is_callable($function)) {
return $function($compare);
}
return false;
}
}
示例11: _isTest
/**
* IsTest method
*
* Prevent intensive W3 test, and the build tests (used to generate the testSection tests) unless
* explicitly specified
*
* @param mixed $method
* @return void
*/
protected function _isTest($method)
{
if (strtolower($method) === 'testaction') {
return false;
}
$buildTests = ['testw3validity', 'testbuildregex', 'testbuildtest'];
if (in_array(strtolower($method), $buildTests)) {
return !$this->skipSetupTests;
}
if (strtolower(substr($method, 0, 4)) === 'test') {
if (!$this->skipSetupTests) {
return false;
}
return !SimpleTestCompatibility::isA($this, strtolower($method));
}
return false;
}
示例12: testIsA
function testIsA()
{
$this->assertTrue(SimpleTestCompatibility::isA(new ComparisonClass(), 'ComparisonClass'));
$this->assertFalse(SimpleTestCompatibility::isA(new ComparisonClass(), 'ComparisonSubclass'));
$this->assertTrue(SimpleTestCompatibility::isA(new ComparisonSubclass(), 'ComparisonClass'));
}
示例13: testInteraceComparison
function testInteraceComparison()
{
$object = new ComparisonClassWithInterface();
$this->assertFalse(SimpleTestCompatibility::isA(new ComparisonClass(), 'ComparisonInterface'));
$this->assertTrue(SimpleTestCompatibility::isA(new ComparisonClassWithInterface(), 'ComparisonInterface'));
}
示例14: test
/**
* Tests the expectation. True if the type or
* class matches the string value.
* @param string $compare Comparison value.
* @return boolean True if correct.
* @access public
*/
function test($compare)
{
if (is_object($compare)) {
return SimpleTestCompatibility::isA($compare, $this->_type);
} else {
return strtolower(gettype($compare)) == $this->_canonicalType($this->_type);
}
}
示例15: _coerceToExpectation
/**
* Creates an equality expectation if the
* object/value is not already some type
* of expectation.
* @param mixed $expected Expected value.
* @return SimpleExpectation Expectation object.
* @access private
*/
function _coerceToExpectation($expected)
{
if (SimpleTestCompatibility::isA($expected, 'SimpleExpectation')) {
return $expected;
}
return new EqualExpectation($expected);
}