Skip to content

Tag: unit-testing

How to test create model service?

I decided to create CreateClassroomService to separte logic in my controller method. I am trying to test this service as part of learning unit testing, but I don’t know how. I don’t know how to mock the classroom object to control what the method should return. Does this mean that creating this se…

Mock class with fluent interface in Phpunit

I am mocking this sample class with fluent methods that doesn’t have return type declaration: Using PhpUnit: By default, this will not work on fluent methods without return type declaration so I need to add the ff.: This works but cumbersome to write if there are a lot fluent methods. My question is, is…