示例#1
0
文件: pramda.php 项目: kapolos/pramda
 public function testPropOr()
 {
     $assoc = ["x" => 100];
     $x = P::propOr('x');
     $y = P::propOr('y');
     $xOr200 = $x(200);
     $yOr200 = $y(200);
     $this->assertEquals(100, P::propOr('x', 200, $assoc));
     $this->assertEquals(200, P::propOr('y', 200, $assoc));
     $this->assertEquals(100, $xOr200($assoc));
     $this->assertEquals(200, $yOr200($assoc));
 }