Skip to content

Adding Swoole's Server mode and settings #59

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Jul 2, 2021

Conversation

leocavalcante
Copy link
Contributor

Closes #58 by

$_SERVER['APP_RUNTIME_OPTIONS'] = [
    'settings' => [
        \Swoole\Constant::OPTION_ENABLE_STATIC_HANDLER => true,
        \Swoole\Constant::OPTION_DOCUMENT_ROOT => dirname(__DIR__).'/public'
    ]
];

@ad3n
Copy link

ad3n commented Jun 22, 2021

Screenshot from 2021-06-22 10-03-53

It's same... I put that in index.php

$_SERVER['APP_RUNTIME_OPTIONS'] = [
    'settings' => [
        Constant::OPTION_ENABLE_STATIC_HANDLER => true,
        Constant::OPTION_DOCUMENT_ROOT => '/semart/public',
    ]
];

@leocavalcante
Copy link
Contributor Author

@ad3n this isn't merged yet.

Copy link
Member

@Nyholm Nyholm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lovely. This is great.

Could you add a small test to it?

@leocavalcante
Copy link
Contributor Author

Sure, I will think on something this weekend.

@leocavalcante
Copy link
Contributor Author

@Nyholm I think this is it.
I have a phpunit.xml with

<testsuite name="E2E">
  <directory>./tests/E2E</directory>
</testsuite>

added.

I wasn't sure how to add a working server to the CI for the E2E, but Unit tests covers 100%.

Copy link
Member

@Nyholm Nyholm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done with the tests!

Isn't all test suites running by default? Ie, we are already running E2E on the CI?

@leocavalcante
Copy link
Contributor Author

leocavalcante commented Jun 28, 2021

Thanks!

All test suites will run, but on the .dist PHPUnit there is only the ./tests/Unit.
I didn't saw a step on the CI for spinning up a runtime and executing E2E, it's kind of a manual step right now:

php tests/E2E/runtime.php

Then:

phpunit --testsuit E2E

I guess that to put on the CI, it is probably something that runtime's directory structure should agree with, like having a /tests folder, maybe just tests/runtime.php.

@Nyholm
Copy link
Member

Nyholm commented Jul 2, 2021

Great. Thank you. Let's improve CI later.

@Nyholm Nyholm merged commit f54e119 into php-runtime:main Jul 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Swoole] Support Static File Handler
3 participants