Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Static Public Member Functions | Data Fields
PhpserverTest Class Reference
Inheritance diagram for PhpserverTest:

Public Member Functions

 setUp ()
 
 testServerHasPid ()
 
 testServerResponds ()
 
 testStaticCssFile ()
 
 testStaticImageFile ()
 

Static Public Member Functions

static setUpBeforeClass ()
 
static tearDownAfterClass ()
 

Data Fields

const BASE_URL = '127.0.0.1:8082'
 

Detailed Description

@magentoAppIsolation enabled

@magentoConfigFixture current_store web/secure/base_url http://127.0.0.1:8082/ @magentoConfigFixture current_store web/unsecure/base_link_url http://127.0.0.1:8082/ @magentoConfigFixture current_store web/secure/base_link_url http://127.0.0.1:8082/ @magentoConfigFixture current_store web/secure/use_in_frontend 0

@magentoAppArea frontend

Definition at line 18 of file PhpserverTest.php.

Member Function Documentation

◆ setUp()

setUp ( )

Definition at line 54 of file PhpserverTest.php.

55  {
56  $this->httpClient = new \Zend\Http\Client(null, ['timeout' => 10]);
57  }

◆ setUpBeforeClass()

static setUpBeforeClass ( )
static

Instantiate phpserver in the pub folder

Definition at line 32 of file PhpserverTest.php.

33  {
34  if (!(defined('TRAVIS') && TRAVIS === true)) {
35  self::markTestSkipped('Travis environment test');
36  }
37  $return = [];
38 
39  $baseDir = __DIR__ . '/../../../../../../';
40  $command = sprintf(
41  'cd %s && php -S %s -t ./pub/ ./phpserver/router.php >/dev/null 2>&1 & echo $!',
42  $baseDir,
43  static::BASE_URL
44  );
45  exec($command, $return);
46  static::$serverPid = (int) $return[0];
47  }
exec($command, array &$output=null, &$return_var=null)
$baseDir
Definition: autoload.php:9
defined('TESTS_BP')||define('TESTS_BP' __DIR__
Definition: _bootstrap.php:60

◆ tearDownAfterClass()

static tearDownAfterClass ( )
static

Definition at line 89 of file PhpserverTest.php.

90  {
91  posix_kill(static::$serverPid, SIGKILL);
92  }

◆ testServerHasPid()

testServerHasPid ( )

Definition at line 59 of file PhpserverTest.php.

60  {
61  $this->assertTrue(static::$serverPid > 0);
62  }

◆ testServerResponds()

testServerResponds ( )

Definition at line 64 of file PhpserverTest.php.

65  {
66  $this->httpClient->setUri($this->getUrl('/'));
67  $response = $this->httpClient->send();
68  $this->assertFalse($response->isClientError());
69  }
$response
Definition: 404.php:11

◆ testStaticCssFile()

testStaticCssFile ( )

Definition at line 71 of file PhpserverTest.php.

72  {
73  $this->httpClient->setUri($this->getUrl('/errors/default/css/styles.css'));
74  $response = $this->httpClient->send();
75 
76  $this->assertFalse($response->isClientError());
77  $this->assertStringStartsWith('text/css', $response->getHeaders()->get('Content-Type')->getMediaType());
78  }
$response
Definition: 404.php:11

◆ testStaticImageFile()

testStaticImageFile ( )

Definition at line 80 of file PhpserverTest.php.

81  {
82  $this->httpClient->setUri($this->getUrl('/errors/default/images/logo.gif'));
83  $response = $this->httpClient->send();
84 
85  $this->assertFalse($response->isClientError());
86  $this->assertStringStartsWith('image/gif', $response->getHeaders()->get('Content-Type')->getMediaType());
87  }
$response
Definition: 404.php:11

Field Documentation

◆ BASE_URL

const BASE_URL = '127.0.0.1:8082'

Definition at line 20 of file PhpserverTest.php.


The documentation for this class was generated from the following file: