当前位置: 首页>>代码示例>>PHP>>正文


PHP Foo类代码示例

本文整理汇总了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();
 }
开发者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


注:本文中的Foo类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。