當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。