本文整理汇总了PHP中Foo类的典型用法代码示例。如果您正苦于以下问题:PHP Foo类的具体用法?PHP Foo怎么用?PHP Foo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Foo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testSpy
public function testSpy()
{
$dependency = $this->prophesize(\Foo\DependencyInterface::class);
$foo = new Foo($dependency->reveal());
$foo->baz();
$dependency->boolGenerator(1)->shouldHaveBeenCalled();
}
示例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));
}
示例3: main
function main()
{
$f = new Foo();
var_dump($f->getter());
$f->heh();
var_dump($f->getter());
}
示例4: testValidationError
/**
* @expectedException Fliglio\Web\ValidationException
*/
public function testValidationError()
{
// given
$expectedFoo = new Foo("invalid");
// when
$expectedFoo->validate();
}
示例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()));
}
示例6: baa
function baa(Foo $param)
{
if ($param->valid()) {
echo 'valid';
} else {
echo 'invalid';
}
}
示例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);
}
示例8: test_dynamic_new
function test_dynamic_new()
{
$f = new Foo();
$f->bar();
$k = "Foo";
$g = new $k();
$g->bar();
}
示例9: testActionKnown
public function testActionKnown()
{
try {
$foo = new Foo(new \Glossary\View());
$foo->action('baz', array());
} catch (Exception $e) {
$this->fail();
}
}
示例10: main
function main()
{
$a = new Foo();
$a->identity(232);
$a->identity(42);
$a->identity(0);
add(1, 1);
add(0, 0);
}
示例11: test
function test()
{
$e = new Foo();
try {
throw new Exception("ops 2");
} catch (Exception $e) {
echo $e->getMessage() . "\n";
}
}
示例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);
}
示例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());
}
示例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;
}
示例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);
}