1 | <?php |
||||||
2 | |||||||
3 | /** |
||||||
4 | * This file is part of slick/configuration |
||||||
5 | * |
||||||
6 | * For the full copyright and license information, please view the LICENSE |
||||||
7 | * file that was distributed with this source code. |
||||||
8 | */ |
||||||
9 | |||||||
10 | namespace spec\Slick\Configuration\Driver; |
||||||
11 | |||||||
12 | use Slick\Configuration\ConfigurationInterface; |
||||||
13 | use Slick\Configuration\Driver\Environment; |
||||||
14 | use PhpSpec\ObjectBehavior; |
||||||
15 | |||||||
16 | /** |
||||||
17 | * EnvironmentSpec specs |
||||||
18 | * |
||||||
19 | * @package spec\Slick\Configuration\Driver |
||||||
20 | */ |
||||||
21 | class EnvironmentSpec extends ObjectBehavior |
||||||
22 | { |
||||||
23 | |||||||
24 | function its_a_configuration_driver() |
||||||
0 ignored issues
–
show
|
|||||||
25 | { |
||||||
26 | $this->shouldBeAnInstanceOf(ConfigurationInterface::class); |
||||||
27 | } |
||||||
28 | |||||||
29 | function it_is_initializable() |
||||||
30 | { |
||||||
31 | $this->shouldHaveType(Environment::class); |
||||||
32 | } |
||||||
33 | |||||||
34 | function it_reads_environment_values() |
||||||
35 | { |
||||||
36 | $this->get('testenv.mode')->shouldBe('develop,debug,coverage'); |
||||||
0 ignored issues
–
show
The method
get() does not exist on spec\Slick\Configuration\Driver\EnvironmentSpec . Since you implemented __call , consider adding a @method annotation.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
37 | } |
||||||
38 | |||||||
39 | function it_returns_a_default_value_if_a_given_key_is_not_found() |
||||||
40 | { |
||||||
41 | $setting = $this->get('baz', true); |
||||||
42 | $setting->shouldBeBoolean(); |
||||||
43 | $setting->shouldBe(true); |
||||||
44 | } |
||||||
45 | |||||||
46 | function it_retrieves_a_value_recursively_using_a_dot_notation() |
||||||
47 | { |
||||||
48 | putenv("FIRST_SECOND_THIRD=123"); |
||||||
49 | $this->get('first.second.third')->shouldBe("123"); |
||||||
50 | } |
||||||
51 | |||||||
52 | function it_sets_a_value_under_a_given_key() |
||||||
53 | { |
||||||
54 | $this->set('other', 'value')->shouldBe($this->getWrappedObject()); |
||||||
0 ignored issues
–
show
The method
set() does not exist on spec\Slick\Configuration\Driver\EnvironmentSpec . Since you implemented __call , consider adding a @method annotation.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
55 | $this->get('other')->shouldBe('value'); |
||||||
56 | } |
||||||
57 | |||||||
58 | function it_sets_a_value_recursively_using_a_dot_notation() |
||||||
59 | { |
||||||
60 | $this->set('value.under.deep', 'path')->shouldBe($this->getWrappedObject()); |
||||||
61 | $this->get('value.under.deep')->shouldBe('path'); |
||||||
62 | } |
||||||
63 | } |
||||||
64 |
Adding explicit visibility (
private
,protected
, orpublic
) is generally recommend to communicate to other developers how, and from where this method is intended to be used.