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

Create PHP configuration test support. #196

Merged
merged 17 commits into from Jul 6, 2013

Conversation

Projects
None yet
2 participants
@koemu
Copy link

koemu commented Jul 4, 2013

Hi, Mr. mizzy.

Thank you very much for your time at hbstudy#45.

I'm added PHP configuration check. However, There is no confidence in testcode.
When you have a time, please check this testcode. Then please advice for me.

Thanks.

Yuichiro Saito (@koemu)

Note: Usage

describe php_config('memory_limit') do
  it { should match_ini_value '128M' }
end
@mizzy

This comment has been minimized.

Copy link
Owner

mizzy commented Jul 4, 2013

Thnaks! I will check it later.

@koemu

This comment has been minimized.

Copy link

koemu commented Jul 4, 2013

I appreciate it.

@mizzy

This comment has been minimized.

Copy link
Owner

mizzy commented Jul 4, 2013

I think this syntax is better because this is same as linux_kernel_parameter.

describe php_config('memory_limit') do
  its(:value) { should eq '128M' }
end
@koemu

This comment has been minimized.

Copy link

koemu commented Jul 5, 2013

Thank you for review my code!
Update code based on your advice. Then I'll repost a "Pull Request".

@mizzy

This comment has been minimized.

Copy link
Owner

mizzy commented Jul 5, 2013

If you update your code and push to this branch, this pull request will be updated.

So you don't need to resend a pull request.

@koemu

This comment has been minimized.

Copy link

koemu commented Jul 5, 2013

So you don't need to resend a pull request.

Sorry about that.

@koemu

This comment has been minimized.

Copy link

koemu commented Jul 5, 2013

I'm just update "php_config".
Please check it, again.

Note: Usage

describe 'php config' do
  context php_config('memory_limit') do
    its(:value) { should eq '128M' }
  end 

  context php_config('default_mimetype') do
    its(:value) { should match /text\/html/ }
  end 

  context php_config('default_socket_timeout') do
    its(:value) { should <= 60 }
  end 
end
end

def to_s
'php_config'

This comment has been minimized.

@mizzy

mizzy Jul 5, 2013

Owner

This shows only php_config and does not show the parameter name when a test fails.
So you should not define this to_s method.

If you don't define this method here, the method defined in base class will be called.
https://github.com/serverspec/serverspec/blob/master/lib/serverspec/type/base.rb#L8

@koemu

This comment has been minimized.

Copy link

koemu commented Jul 6, 2013

Sorry. I'll verify.

@mizzy mizzy merged commit 685b22b into mizzy:master Jul 6, 2013

@mizzy

This comment has been minimized.

Copy link
Owner

mizzy commented Jul 6, 2013

Thanks.

I've changed how to write test code recently, so I've fixed tests and merged your pull request.

This resource type will be very useful.Thanks a lot!

@koemu

This comment has been minimized.

Copy link

koemu commented Jul 8, 2013

Thank you very much for your coding advice, too.

(From here, I written in Japanese.)

テストコードの記述に際して、お手数をおかけして恐縮でした。
いただいたアドバイスとコードを基に、次回のPull Requestでは完成度を上げて行くようにします。
また、今回のPHPの設定テストが、皆様のお役に立てば幸いです。

どうもありがとうございました。

@koemu koemu deleted the koemu:php-config-test branch Jul 8, 2013

@mizzy

This comment has been minimized.

Copy link
Owner

mizzy commented Jul 8, 2013

こちらこそありがとうございました。プルリクエスト送って頂くだけでもとてもありがたいので、あまり難しく考えずに、お気軽に送ってください。

php.ini まわりはトラブルが起きやすいので、こんな風に簡単にテストできる仕組みがあると、とても役立つと思います。

ありがとうございました。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment