| 1 | <?php |
||
| 10 | class FactorySpec extends ObjectBehavior |
||
| 11 | { |
||
| 12 | function let() |
||
| 13 | { |
||
| 14 | $this->beConstructedWith( |
||
| 15 | function (){ |
||
| 16 | return 'Test Callable'; |
||
| 17 | } |
||
| 18 | ); |
||
| 19 | } |
||
| 20 | |||
| 21 | function it_is_initializable() |
||
| 22 | { |
||
| 23 | $this->shouldHaveType(Factory::class); |
||
| 24 | } |
||
| 25 | |||
| 26 | function its_a_definition() |
||
| 27 | { |
||
| 28 | $this->shouldBeAnInstanceOf(DefinitionInterface::class); |
||
| 29 | } |
||
| 30 | |||
| 31 | function it_resolves_to_the_callable_return() |
||
| 32 | { |
||
| 33 | $this->resolve()->shouldBe('Test Callable'); |
||
| 34 | } |
||
| 35 | |||
| 36 | function it_can_have_parameters_to_pass_to_callable_on_resolve() |
||
| 37 | { |
||
| 38 | $this->beConstructedWith( |
||
| 39 | function ($test) { |
||
| 40 | return $test; |
||
| 41 | }, |
||
| 42 | ['test with parameters'] |
||
| 43 | ); |
||
| 44 | $this->resolve()->shouldBe('test with parameters'); |
||
| 45 | } |
||
| 46 | } |
||
| 47 |