55 */
66namespace Magento \PageCache \Test \Unit \Model \Cache ;
77
8+ use \Magento \Framework \TestFramework \Unit \Helper \ObjectManager ;
9+ use \Magento \PageCache \Model \Cache \Server ;
810use \Zend \Uri \UriFactory ;
911
1012class ServerTest extends \PHPUnit_Framework_TestCase
1113{
12- /** @var \Magento\PageCache\Model\Cache\ Server */
14+ /** @var Server */
1315 protected $ model ;
1416
1517 /** @var \PHPUnit_Framework_MockObject_MockObject | \Magento\Framework\App\DeploymentConfig */
@@ -30,7 +32,7 @@ public function setUp()
3032 ->disableOriginalConstructor ()
3133 ->getMock ();
3234
33- $ objectManager = new \ Magento \ Framework \ TestFramework \ Unit \ Helper \ ObjectManager ($ this );
35+ $ objectManager = new ObjectManager ($ this );
3436 $ this ->model = $ objectManager ->getObject (
3537 'Magento\PageCache\Model\Cache\Server ' ,
3638 [
@@ -56,12 +58,9 @@ public function testGetUris(
5658 $ url ,
5759 $ hostConfig = null
5860 ) {
59- $ this ->configMock ->expects ($ this ->once ())
60- ->method ('get ' )
61- ->willReturn ($ hostConfig );
62- $ this ->requestMock ->expects ($ this ->exactly ($ getHttpHostCallCtr ))
63- ->method ('getHttpHost ' )
64- ->willReturn ($ httpHost );
61+ $ this ->configMock ->expects ($ this ->once ())->method ('get ' )->willReturn ($ hostConfig );
62+ $ this ->requestMock ->expects ($ this ->exactly ($ getHttpHostCallCtr ))->method ('getHttpHost ' )->willReturn ($ httpHost );
63+
6564 $ this ->urlBuilderMock ->expects ($ this ->exactly ($ getUrlCallCtr ))
6665 ->method ('getUrl ' )
6766 ->with ('* ' , ['_nosid ' => true ])
@@ -70,30 +69,32 @@ public function testGetUris(
7069 $ uris = [];
7170 if (null === $ hostConfig ) {
7271 if (!empty ($ httpHost )) {
73- $ uris [] = UriFactory::factory ('' )->setHost ($ httpHost )
74- ->setPort (\Magento \PageCache \Model \Cache \Server::DEFAULT_PORT )
75- ->setScheme ('http ' );
72+ $ uris [] = UriFactory::factory ('' )->setHost ($ httpHost )->setPort (Server::DEFAULT_PORT );
7673 }
7774 if (!empty ($ url )) {
7875 $ uris [] = UriFactory::factory ($ url );
7976 }
8077 } else {
8178 foreach ($ hostConfig as $ host ) {
82- $ port = isset ($ host ['port ' ]) ? $ host ['port ' ] : \Magento \PageCache \Model \Cache \Server::DEFAULT_PORT ;
83- $ uris [] = UriFactory::factory ('' )->setHost ($ host ['host ' ])
84- ->setPort ($ port )
85- ->setScheme ('http ' );
79+ $ port = isset ($ host ['port ' ]) ? $ host ['port ' ] : Server::DEFAULT_PORT ;
80+ $ uris [] = UriFactory::factory ('' )->setHost ($ host ['host ' ])->setPort ($ port );
8681 }
8782 }
8883
84+ foreach ($ uris as $ key => $ value ) {
85+ $ uris [$ key ]->setScheme ('http ' )
86+ ->setPath ('/ ' )
87+ ->setQuery (null );
88+ }
89+
8990 $ this ->assertEquals ($ uris , $ this ->model ->getUris ());
9091 }
9192
9293 public function getUrisDataProvider ()
9394 {
9495 return [
95- 'http host ' => [1 , '127.0.0.1 ' , 0 , '' , ],
96- 'url ' => [1 , '' , 1 , 'http://host ' , ],
96+ 'http host ' => [2 , '127.0.0.1 ' , 0 , '' ],
97+ 'url ' => [1 , '' , 1 , 'http://host ' ],
9798 'config ' => [
9899 0 ,
99100 '' ,
0 commit comments