本文整理汇总了PHP中Foo类的典型用法代码示例。如果您正苦于以下问题:PHP Foo类的具体用法?PHP Foo怎么用?PHP Foo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Foo类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: testSpy
public function testSpy()
{
$dependency = $this->prophesize(\Foo\DependencyInterface::class);
$foo = new Foo($dependency->reveal());
$foo->baz();
$dependency->boolGenerator(1)->shouldHaveBeenCalled();
}
开发者ID:dave1010,项目名称:php-empty,代码行数:7,代码来源:FooTest.php
示例2: testMockedMethodIsProxiedToOriginalMethod
public function testMockedMethodIsProxiedToOriginalMethod()
{
$proxy = $this->getMockBuilder('Bar')->enableProxyingToOriginalMethods()->getMock();
$proxy->expects($this->once())->method('doSomethingElse');
$foo = new Foo();
$this->assertEquals('result', $foo->doSomething($proxy));
}
开发者ID:cruni505,项目名称:prestomed,代码行数:7,代码来源:ProxyObjectTest.php
示例3: main
function main()
{
$f = new Foo();
var_dump($f->getter());
$f->heh();
var_dump($f->getter());
}
开发者ID:badlamer,项目名称:hhvm,代码行数:7,代码来源:minstr_006.php
示例4: testValidationError
/**
* @expectedException Fliglio\Web\ValidationException
*/
public function testValidationError()
{
// given
$expectedFoo = new Foo("invalid");
// when
$expectedFoo->validate();
}
开发者ID:fliglio,项目名称:web,代码行数:10,代码来源:ValidationTraitTest.php
示例5: testLoadConfigFromFile
public function testLoadConfigFromFile()
{
$file = __DIR__ . '/fixtures/configurabletrait-test.php';
$foo = new Foo();
$foo->loadConfigFromFile($file);
$this->assertTrue(in_array($file, get_included_files()));
}
开发者ID:lytc,项目名称:sloths,代码行数:7,代码来源:ConfigurableTraitTest.php
示例6: baa
function baa(Foo $param)
{
if ($param->valid()) {
echo 'valid';
} else {
echo 'invalid';
}
}
开发者ID:robo47,项目名称:php-manipulator,代码行数:8,代码来源:input9.php
示例7: testPhpError
/**
* This test function contains a code which will
* create a php warning to happen. This eample show
* that in phpunit it will treated as an exception and
* it could be catched by 'expectedException' tag and
* exception name would be 'PHPUnit_Framework_Error'
*
* @expectedException PHPUnit_Framework_Error
*/
public function testPhpError()
{
$foo_obj = new Foo();
# Line below will throw an exception here only
$foo_obj->bar();
# Code execution will never reach this point
$this->assertTrue(true);
}
开发者ID:p-ja,项目名称:phpunit-examples,代码行数:17,代码来源:09TestPhpErrors.php
示例8: test_dynamic_new
function test_dynamic_new()
{
$f = new Foo();
$f->bar();
$k = "Foo";
$g = new $k();
$g->bar();
}
开发者ID:badlamer,项目名称:hhvm,代码行数:8,代码来源:dynamic_new.php
示例9: testActionKnown
public function testActionKnown()
{
try {
$foo = new Foo(new \Glossary\View());
$foo->action('baz', array());
} catch (Exception $e) {
$this->fail();
}
}
开发者ID:eott,项目名称:glossary,代码行数:9,代码来源:AbstractControllerTest.php
示例10: main
function main()
{
$a = new Foo();
$a->identity(232);
$a->identity(42);
$a->identity(0);
add(1, 1);
add(0, 0);
}
开发者ID:afaltz,项目名称:hhvm,代码行数:9,代码来源:simple_test.php
示例11: test
function test()
{
$e = new Foo();
try {
throw new Exception("ops 2");
} catch (Exception $e) {
echo $e->getMessage() . "\n";
}
}
开发者ID:badlamer,项目名称:hhvm,代码行数:9,代码来源:bug53511.php
示例12: main
function main()
{
// just checking it can be default-constructed...
var_dump((new Foo())->getMessage());
$junk = new Exception();
$foo = new Foo('hello, world', 1337, $junk);
var_dump($foo->getMessage());
var_dump($foo->getCode());
var_dump($foo->getPrevious() === $junk);
}
开发者ID:badlamer,项目名称:hhvm,代码行数:10,代码来源:exception_subclass.php
示例13: testDeleteAllMethod
public function testDeleteAllMethod()
{
$foo = new Foo();
$foo->setProperty(array('foo' => 'boo', 'bar' => 'moo'));
$this->assertEquals(array('foo' => 'boo', 'bar' => 'moo'), $foo->getProperty());
$foo->deleteProperty();
$this->assertEquals(array(), $foo->getProperty());
$this->assertFalse($foo->hasPropertyKey('foo'));
$this->assertCount(0, $foo->getProperty());
}
开发者ID:eat24,项目名称:PostgresHstoreBehavior,代码行数:10,代码来源:PostgresHstoreBehaviorTest.php
示例14: array
/**
* Returns a collection of Foo instances according to
* the configuration section.
*/
public function &process(__ConfigurationSection &$section)
{
$return_value = array();
$foobars = $section->getSections();
foreach ($foobars as &$foobar) {
$foo = new Foo();
$foo->setBar($foobar->getAttribute('bar'));
$return_value[] = $foo;
}
return $return_value;
}
开发者ID:laiello,项目名称:lion-framework,代码行数:15,代码来源:SectionHandler.class.php
示例15: testStaticApiMapper
public function testStaticApiMapper()
{
// given
$entity = new Foo("foo");
$vo = ["myProp" => "foo"];
// when
$foundVo = $entity->marshal();
$foundEntity = Foo::unmarshal($vo);
// then
$this->assertEquals($entity, $foundEntity);
$this->assertEquals($vo, $foundVo);
}
开发者ID:fliglio,项目名称:web,代码行数:12,代码来源:ApiMapperTest.php
示例16: eraseData
protected function eraseData()
{
Foo::truncate();
Bar::truncate();
Baz::truncate();
Bom::truncate();
}
开发者ID:leloulight,项目名称:trigglog,代码行数:7,代码来源:TestCase.php
示例17: go
function go()
{
$y = Foo::fun();
var_dump($y);
$y = Foo::fun();
var_dump($y);
}
开发者ID:badlamer,项目名称:hhvm,代码行数:7,代码来源:magic_call_010.php
示例18: test_kissmock_usage
public function test_kissmock_usage()
{
$bar = new BarMock();
$bar->_mock->setMethodReturnValue('methodBar', 'a', 1);
$bar->_mock->setMethodReturnValue('methodBar', 'b', 2);
$foo = new Foo($bar);
$ret1 = $foo->methodFoo();
$ret2 = $foo->methodFoo();
$this->assertEqual($ret1, 'a');
$this->assertEqual($ret2, 'b');
$callCount = $bar->_mock->getMethodCallCount('methodBar');
$this->assertEqual($callCount, 2);
$args1 = $bar->_mock->getMethodArgs('methodBar', 1);
$args2 = $bar->_mock->getMethodArgs('methodBar', 2);
$this->assertEqual($args1[0], 1);
$this->assertEqual($args1[1], 'two');
$this->assertEqual($args2[0], 1);
$this->assertEqual($args2[1], 'two');
}
开发者ID:joefallon,项目名称:kisstest,代码行数:19,代码来源:MocksUsage.php
示例19: invoke
public static function invoke(Foo $instance)
{
// Same class, other instance, direct call.
$instance->call();
// Same class, other instance, indirect call.
$foo = new Foo();
$foo->call();
// Same class, other instance, indirect call.
$x = new Foo();
$y = $x;
$z = $y;
$z->call();
// Same class, other instance, direct call.
(new Foo())->call();
// Other class, other instance, indirect call.
$bar = new Bar();
$bar->call();
// Other class, other instance, direct call.
(new Bar())->call();
}
开发者ID:basilfx,项目名称:php-obfuscator,代码行数:20,代码来源:private_public_methods.in.php
示例20: main
function main()
{
$k = new Foo("something");
echo $k->getX();
echo "\n";
$k->setX("foo");
echo $k->getX();
echo "\n";
$k->setXVerified("string");
echo $k->getX();
echo "\n";
$k->setY(new Bar());
}
开发者ID:badlamer,项目名称:hhvm,代码行数:13,代码来源:setter.php
注:本文中的Foo类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论