Skip to content

Commit b82c2ff

Browse files
committed
Merge pull request #30 from php-http/extract_message_factory
Extract factories
2 parents ced3b90 + bbfe827 commit b82c2ff

25 files changed

+116
-505
lines changed

.travis.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ cache:
77
- $HOME/.composer/cache
88

99
php:
10-
- 5.4
1110
- 5.5
1211
- 5.6
1312
- 7.0
@@ -24,7 +23,7 @@ branches:
2423
matrix:
2524
fast_finish: true
2625
include:
27-
- php: 5.4
26+
- php: 5.5
2827
env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest" COVERAGE=true TEST_COMMAND="composer test-ci"
2928

3029
before_install:

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@
1919
"php-http/message-factory": "^1.0"
2020
},
2121
"require-dev": {
22+
"php-http/utils": "^0.2",
2223
"zendframework/zend-diactoros": "^1.0",
2324
"guzzlehttp/psr7": "^1.0",
2425
"php-http/guzzle6-adapter": "^0.2",
2526
"phpspec/phpspec": "^2.4",
2627
"henrikbjorn/phpspec-code-coverage" : "^1.0"
2728
},
2829
"suggest": {
29-
"zendframework/zend-diactoros": "Used with Diactoros Factories",
30-
"guzzlehttp/psr7": "Used with Guzzle PSR-7 Factories"
30+
"php-http/utils": "To use Guzzle or Diactoros factories"
3131
},
3232
"autoload": {
3333
"psr-4": {

spec/ClassDiscoverySpec.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,28 @@ function it_registers_a_class_with_a_boolean_condition()
5656
$this->find()->shouldHaveType('spec\Http\Discovery\AnotherClassToFind');
5757
}
5858

59+
function it_registers_a_class_with_an_array_condition()
60+
{
61+
$this->reset();
62+
63+
$this->register(
64+
'spec\Http\Discovery\AnotherClassToFind',
65+
[
66+
true,
67+
'spec\Http\Discovery\AnotherClassToFind',
68+
]
69+
);
70+
$this->register(
71+
'spec\Http\Discovery\ClassToFind',
72+
[
73+
false,
74+
'spec\Http\Discovery\ClassToFind',
75+
]
76+
);
77+
78+
$this->find()->shouldHaveType('spec\Http\Discovery\AnotherClassToFind');
79+
}
80+
5981
function it_registers_a_class_with_an_invalid_condition()
6082
{
6183
$this->reset();

spec/MessageFactory/DiactorosMessageFactorySpec.php

Lines changed: 0 additions & 47 deletions
This file was deleted.

spec/MessageFactory/GuzzleMessageFactorySpec.php

Lines changed: 0 additions & 29 deletions
This file was deleted.

spec/MessageFactoryDiscoverySpec.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ function it_is_a_class_discovery()
1616
$this->shouldHaveType('Http\Discovery\ClassDiscovery');
1717
}
1818

19+
function it_is_a_factory_discovery()
20+
{
21+
$this->shouldHaveType('Http\Discovery\FactoryDiscovery');
22+
}
23+
1924
function it_finds_an_http_message_factory()
2025
{
2126
$this->find()->shouldHaveType('Http\Message\MessageFactory');

spec/StreamFactory/DiactorosStreamFactorySpec.php

Lines changed: 0 additions & 49 deletions
This file was deleted.

spec/StreamFactory/GuzzleStreamFactorySpec.php

Lines changed: 0 additions & 49 deletions
This file was deleted.

spec/StreamFactoryDiscoverySpec.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ function it_is_a_class_discovery()
1616
$this->shouldHaveType('Http\Discovery\ClassDiscovery');
1717
}
1818

19+
function it_is_a_factory_discovery()
20+
{
21+
$this->shouldHaveType('Http\Discovery\FactoryDiscovery');
22+
}
23+
1924
function it_finds_an_http_stream_factory()
2025
{
2126
$this->find()->shouldHaveType('Http\Message\StreamFactory');

spec/UriFactory/DiactorosUriFactorySpec.php

Lines changed: 0 additions & 42 deletions
This file was deleted.

spec/UriFactory/GuzzleUriFactorySpec.php

Lines changed: 0 additions & 34 deletions
This file was deleted.

spec/UriFactoryDiscoverySpec.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ function it_is_a_class_discovery()
1616
$this->shouldHaveType('Http\Discovery\ClassDiscovery');
1717
}
1818

19+
function it_is_a_factory_discovery()
20+
{
21+
$this->shouldHaveType('Http\Discovery\FactoryDiscovery');
22+
}
23+
1924
function it_finds_an_http_uri_factory()
2025
{
2126
$this->find()->shouldHaveType('Http\Message\UriFactory');

0 commit comments

Comments
 (0)