/** @test */
 public function it_calls_the_method_and_returns_the_value()
 {
     $fn = Transform::callMethod('getValue');
     $this->assertSame(123, $fn(new MethodReturning(123)));
 }
 /** @test */
 public function it_calls_a_static_method_with_the_value_as_an_argument_and_returns_the_result()
 {
     $fn = Transform::argumentTo([__CLASS__, 'staticDecrement']);
     $this->assertSame(3, $fn(4));
 }
Example #3
0
 /** @test */
 public function it_returns_value_of_a_nested_array_entry()
 {
     $fn = Transform::getEntry(['user', 'name']);
     $this->assertSame('Tom', $fn(['user' => ['name' => 'Tom']]));
 }