當前位置: 首頁>>代碼示例>>PHP>>正文


PHP it函數代碼示例

本文整理匯總了PHP中it函數的典型用法代碼示例。如果您正苦於以下問題:PHP it函數的具體用法?PHP it怎麽用?PHP it使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了it函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: it_setups

 function it_setups()
 {
     $command = new Command();
     $this->setup($command);
     it($command->isGlobal())->shouldBe(true);
     it($command->isHidden())->shouldBe(true);
 }
開發者ID:weew,項目名稱:console,代碼行數:7,代碼來源:GlobalVerbosityCommandSpec.php

示例2: it_provides_five_entry_points

 /**
  * @test
  */
 public function it_provides_five_entry_points()
 {
     $instances = [it(null), this(null), these(null), those(null), that(null)];
     foreach ($instances as $instance) {
         $this->assertInstanceOf("Essence\\Essence", $instance);
     }
 }
開發者ID:bound1ess,項目名稱:essence,代碼行數:10,代碼來源:FunctionsTest.php

示例3: testBothFunctions

 protected function testBothFunctions($input, $expected)
 {
     $actual = $this->fibonacciProduct($input);
     it(sprintf('computes Fibonacci product for %d as %d -- clear  code', $input, $actual), $actual === $expected);
     $actual = $this->getFunctionOutput(function () use($input) {
         return $this->fbnccPrdct(2, array(__FILE__, $input));
     });
     it(sprintf('computes Fibonacci product for %d as %d -- golfed code', $input, $actual), $actual == $expected);
 }
開發者ID:axiac,項目名稱:code-golf,代碼行數:9,代碼來源:fibonacci-products.php

示例4: it_has_valid_masks

 function it_has_valid_masks()
 {
     it(OutputVerbosity::NORMAL & OutputVerbosity::VERBOSE)->shouldBe(OutputVerbosity::NORMAL);
     it(OutputVerbosity::NORMAL & OutputVerbosity::DEBUG)->shouldBe(OutputVerbosity::NORMAL);
     it(OutputVerbosity::VERBOSE & OutputVerbosity::DEBUG)->shouldBe(OutputVerbosity::VERBOSE);
     it(OutputVerbosity::NORMAL & OutputVerbosity::SILENT)->shouldBe(0);
     it(OutputVerbosity::VERBOSE & OutputVerbosity::SILENT)->shouldBe(0);
     it(OutputVerbosity::DEBUG & OutputVerbosity::SILENT)->shouldBe(0);
 }
開發者ID:weew,項目名稱:console,代碼行數:9,代碼來源:OutputVerbositySpec.php

示例5: it_initializes

 function it_initializes()
 {
     $container = new Container();
     $this->initialize($container);
     it($container->has(TwigLoader::class))->shouldBe(true);
     it($container->has(Twig_Loader_Filesystem::class))->shouldBe(true);
     it($container->has(Twig::class))->shouldBe(true);
     it($container->has(Twig_Environment::class))->shouldBe(true);
 }
開發者ID:weew,項目名稱:app-twig,代碼行數:9,代碼來源:TwigProviderSpec.php

示例6: it_formats_with_ansi_and_styles

 function it_formats_with_ansi_and_styles()
 {
     $this->style('red')->setColor('red')->setBackground('white')->setFormat(['bold', 'dim']);
     $this->style('blue')->allowInheritance(true)->setColor('blue')->setBackground('red')->setFormat('italic');
     $result = $this->format('<style color=red><red>red<blue>blue\\<x><red>red</red></blue>red</red></style>')->getWrappedObject();
     $result = str_replace("", '', $result);
     $expected = '[0;31m[0;31;107;1;2mred[34;41;3mblue<x>[0;31;107;1;2mred[34;41;3m[0;31;107;1;2mred[0;31m[0m';
     it($result)->shouldBe($expected);
 }
開發者ID:weew,項目名稱:console-formatter,代碼行數:9,代碼來源:ConsoleFormatterSpec.php

示例7: describe

 public function describe(array $data = null)
 {
     if ($data) {
         $this->data = $data;
     }
     $self = $this;
     describe("TOKEN SERVEICE", function () use($self) {
         it("CAN STORE & LOAD EACH DATA", [$self, "testStoreAndLoadData"]);
     });
 }
開發者ID:chatbox-inc,項目名稱:token,代碼行數:10,代碼來源:TokenServiceSpecs.php

示例8: it_initializes

 function it_initializes()
 {
     $container = new Container();
     $this->beConstructedWith($container);
     $this->initialize($container);
     it($container->has(ISwiftMailerManager::class))->shouldBe(true);
     it($container->has(SwiftMailerManager::class))->shouldBe(true);
     it($container->has(SwiftMailer::class))->shouldBe(true);
     it($container->has(Swift_Mailer::class))->shouldBe(true);
 }
開發者ID:weew,項目名稱:app-swift-mailer,代碼行數:10,代碼來源:SwiftMailerProviderSpec.php

示例9: testBothMethods

 protected function testBothMethods($input, $expected)
 {
     // The clean code
     $actual = $this->checkIfPangram($input);
     it(sprintf("thinks '%s' %s a pangram (clear  code).", $input, $actual ? 'is' : 'is not'), $actual == $expected);
     // The golfed code
     $actual = $this->getFunctionOutput(function () use($input) {
         $this->chkPngrm(2, array(__FILE__, $input));
     });
     it(sprintf("thinks '%s' %s a pangram (golfed code).", $input, $actual ? 'is' : 'is not'), $actual == $expected);
 }
開發者ID:axiac,項目名稱:code-golf,代碼行數:11,代碼來源:is-it-a-pangram.php

示例10: testDoorStatus

 /**
  * Test helper. Test both scripts (plain and golfed version) using the test framework.
  * Check their actual output against the expected output.
  *
  * @param int[]  $delays  the input argument (the number of seconds to wait before pushing the button)
  * @param string $expected the expected program output
  */
 protected function testDoorStatus(array $delays, $expected)
 {
     // Format the input for display
     $input = implode(' ', $delays);
     // Put the script path in front of the arguments; the real program gets its arguments from the command line
     array_unshift($delays, __FILE__);
     // Test the plain-code function
     it(sprintf("turns input '%s' into output '%s' -- clear  version", $input, $expected), $this->getFunctionOutput(function () use($delays) {
         $this->handleDoor($delays);
     }) === $expected);
     // Test the golfed function
     it(sprintf("turns input '%s' into output '%s' -- golfed version", $input, $expected), $this->getFunctionOutput(function () use($delays) {
         $this->hndlDr($delays);
     }) === $expected);
 }
開發者ID:axiac,項目名稱:code-golf,代碼行數:22,代碼來源:is-the-electric-garage-door-open.php

示例11: testImplementation

 function testImplementation($implementation)
 {
     it('can boot using given papertrail log host and port', function () use($implementation) {
         $logger = $implementation::boot($this->host, $this->port);
         $message = 'this is a test log message';
         $logger->info($message);
         expect($this->papertrailClient->getLastEvent()->message)->toContain($message);
     });
     it('can boot using given log message prefix', function () use($implementation) {
         $prefix = '@PREFIX@';
         $logger = $implementation::bootWithPrefix($prefix);
         $message = 'this is a test log message';
         $logger->info($message);
         $actualMessage = $this->papertrailClient->getLastEvent()->message;
         expect($actualMessage)->toContain("[{$prefix}]");
         expect($actualMessage)->toContain($message);
     });
 }
開發者ID:stephanecoinon,項目名稱:papertrail,代碼行數:18,代碼來源:AllImplentationsSpec.php

示例12: gensuite

 public static function gensuite($config = array(), $current_depth = 1)
 {
     $config = array_merge(array('befores' => 0, 'before_alls' => 0, 'afters' => 0, 'after_alls' => 0, 'tests' => 1, 'depth' => 0, 'describes' => array('L', 'R'), 'callbacks' => array('it' => function ($ctx) {
         expect(true)->to->eql(true);
     }, 'before' => function ($ctx) {
         $ctx->value = 3;
     }, 'before_all' => function ($ctx) {
         $ctx->value = 5;
     }, 'after' => function ($ctx) {
         $ctx->value = 7;
     }, 'after_all' => function ($ctx) {
         $ctx->value = 11;
     })), $config);
     if ($config['depth'] == 0) {
         return;
     }
     foreach ($config['describes'] as $side) {
         describe("Level {$side}{$current_depth}", function ($ctx) use($config, $current_depth) {
             for ($i = 1; $i <= $config['tests']; $i++) {
                 it("nested {$i}", $config['callbacks']['it']);
             }
             for ($i = 1; $i <= $config['befores']; $i++) {
                 before($config['callbacks']['before']);
             }
             for ($i = 1; $i <= $config['before_alls']; $i++) {
                 before_all($config['callbacks']['before_all']);
             }
             for ($i = 1; $i <= $config['after_alls']; $i++) {
                 after_all($config['callbacks']['after_all']);
             }
             for ($i = 1; $i <= $config['afters']; $i++) {
                 after($config['callbacks']['after']);
             }
             $config['depth']--;
             Util::gensuite($config, $current_depth + 1);
         });
     }
 }
開發者ID:aaron-em,項目名稱:matura,代碼行數:38,代碼來源:Util.php

示例13: testAllFunctions

 /**
  * The tester for both methods, the clean code and the golfed code
  *
  * @param int $n
  * @param int $expected
  */
 protected function testAllFunctions($n, $expected)
 {
     // The clean code method 1
     $startTime = microtime(TRUE);
     $result = $this->countLatticePoints1($n) === $expected;
     $runTime = microtime(TRUE) - $startTime;
     it(sprintf('it computes f(%d)=%d -- clean  code #1; time=%f s', $n, $expected, $runTime), $result);
     // The golfed code method 1
     $startTime = microtime(TRUE);
     $result = $this->cntLttcPnts1($n) === $expected;
     $runTime = microtime(TRUE) - $startTime;
     it(sprintf('it computes f(%d)=%d -- golfed code #1; time=%f s', $n, $expected, $runTime), $result);
     // The clean code method 2
     $startTime = microtime(TRUE);
     $result = $this->countLatticePoints2($n) === $expected;
     $runTime = microtime(TRUE) - $startTime;
     it(sprintf('it computes f(%d)=%d -- clean  code #2; time=%f s', $n, $expected, $runTime), $result);
     // The golfed code method 2
     $startTime = microtime(TRUE);
     $result = $this->cntLttcPnts2($n) === $expected;
     $runTime = microtime(TRUE) - $startTime;
     it(sprintf('it computes f(%d)=%d -- golfed code #2; time=%f s', $n, $expected, $runTime), $result);
 }
開發者ID:axiac,項目名稱:code-golf,代碼行數:29,代碼來源:lattice-points-inside-a-circle.php

示例14: it

        });
        it('throws RuntimeException when the resource is already closed', function () {
            expect(function () {
                $resource = fopen('php://memory', 'r');
                fclose($resource);
                $stream = new Stream($resource);
                $stream->getContents();
            })->toThrow(new RuntimeException());
        });
        it('returns content', function () {
            $resource = fopen('php://memory', 'w+');
            fwrite($resource, 'Hello');
            fseek($resource, 0);
            expect((new Stream($resource))->getContents())->toBe('Hello');
        });
    });
    describe('->getMetadata', function () {
        it('returns null if when there is no resource', function () {
            expect((new Stream(NULL))->getMetadata())->toBeNull();
            expect((new Stream(NULL))->getMetadata('anykey'))->toBeNull();
        });
        it('returns all metadata when no key given', function () {
            $stream = new Stream(fopen('php://memory', 'r'));
            expect($stream->getMetadata())->toBeA('array')->toContainKey('uri');
            expect($stream->getMetadata()['uri'])->toBe('php://memory');
        });
        it('returns value for given key', function () {
            expect((new Stream(fopen('php://memory', 'r')))->getMetadata('uri'))->toBe('php://memory');
        });
    });
});
開發者ID:guide42,項目名稱:ochenta,代碼行數:31,代碼來源:StreamSpec.php

示例15: expect

            $title = $console->formatter->grey($spec->getTitle());
            expect($afterSpec)->toPrint($title . PHP_EOL);
        });
        it('prints the spec title in red if it failed', function () use(&$console, &$spec) {
            $suite = new Suite('test', function () {
            });
            $spec = new Spec('testspec', function () {
                throw new \Exception('test');
            }, $suite);
            $spec->run();
            $afterSpec = function () use($console, $spec) {
                $reporter = new SpecReporter($console);
                $reporter->afterSpec($spec);
            };
            $specTitle = $console->formatter->red($spec->getTitle());
            expect($afterSpec)->toPrint($specTitle . PHP_EOL);
        });
        it('prints the spec title in cyan if incomplete', function () use(&$console, $spec) {
            $suite = new Suite('test', function () {
            });
            $spec = new Spec('testspec', null, $suite);
            $spec->run();
            $afterSpec = function () use($console, $spec) {
                $reporter = new SpecReporter($console);
                $reporter->afterSpec($spec);
            };
            $specTitle = $console->formatter->cyan($spec->getTitle());
            expect($afterSpec)->toPrint($specTitle . PHP_EOL);
        });
    });
});
開發者ID:ciarand,項目名稱:pho,代碼行數:31,代碼來源:SpecReporterSpec.php


注:本文中的it函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。