当前位置: 首页>>代码示例>>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;未经允许,请勿转载。