Skip to main content

Questions tagged [phpunit]

PHPUnit is the de facto standard for writing unit tests for PHP code.

Filter by
Sorted by
Tagged with
4 votes
1 answer
174 views

I am making a base test class that bootstraps database Test cases ...
Dimitrios Desyllas's user avatar
2 votes
0 answers
65 views

I want to unit test my PHP website, which uses the outdated framework CodeIgniter 3. CodeIgniter 3 uses the MVC pattern, and each page on the website corresponds to a public method in a controller. I ...
RedDragonWebDesign's user avatar
1 vote
1 answer
126 views

First of all I must thank for the help given in the previous post: Class showing a format similar to var_dump RC5 Version I have it deployed in a early versio v1.0.5: https://github.com/arcanisgk/BOH-...
user avatar
2 votes
1 answer
145 views

I have created a test, also the interfaces to be implemented for each test case based on user's role because I think it would make it easier to understand what the test case will and should do, also ...
Yura's user avatar
  • 121
3 votes
1 answer
87 views

I don't have much experience with testing but I'm trying to make it part of my routine to develop better software. The class below is a service class in Laravel. It needs to save a record on the ...
Daniel Costa's user avatar
1 vote
2 answers
231 views

I have a Responder class whose prepare method takes an entity, checks it with a validator, and returns a response or errorResponse based on the results of validator....
EresDev's user avatar
  • 121
4 votes
1 answer
177 views

I want to improve the logic for bill settlement and calculation of amount due. I managed to write code with T.D.D., but I think those loops could be improved somehow. Do you have any ideas on that ...
Kalpa Perera's user avatar
3 votes
0 answers
642 views

I have been reading up on TDD and it's something I genuinely want to learn and be good at. This is something I haven't been doing as a developer and I thought it's about time I get into it. These are ...
Latheesan's user avatar
  • 303
6 votes
1 answer
261 views

This code review request relates to this code review which covers the basic single REST call use case in this REST client library. This code review covers the classes and unit tests for the multiple ...
Mike Brant's user avatar
  • 9,878
6 votes
1 answer
222 views

This is a second iteration on an earlier review - cURL based REST client library I have done some refactoring to split out the REST HTTP response into it's own class from what was in the previous ...
Mike Brant's user avatar
  • 9,878
3 votes
2 answers
837 views

I have recently refactored a REST client library and was hoping to get review for both the class itself and the unit tests that cover it. This code is developed against PHP 7.1, but tested against ...
Mike Brant's user avatar
  • 9,878
2 votes
0 answers
103 views

This is my first PHPUnit test with mocks, for a Symfony 3 project. Can anyone give me some advice about this code? ...
user avatar
0 votes
0 answers
452 views

I made a class that will be used to get an image properties like width, height, and MIME type. ...
Dwi Purnomo's user avatar
3 votes
2 answers
196 views

The following code snippet is about adding rules that filters Payment Methods listing to customer, for email we provide 4 different types of payment methods, but we do show them depending on some ...
Dahab's user avatar
  • 159
1 vote
1 answer
461 views

I am trying to test my first functional tests. I would like to know if my functional test is well done, or if the structure of it is not optimal. Any advice will be useful to me. As I said, I just ...
user124435's user avatar
4 votes
1 answer
170 views

I have a class that is all about doing HTTP requests, and logging (in file system & database). It's only using 3 dependencies to do these things, so I'm fine with the code so far. Here it is for ...
Steve Chamaillard's user avatar
0 votes
1 answer
198 views

I am practicing to code in the right way and make it testable. Please review this code and tell me anything bad practices of it. Entity: ...
Kakashi's user avatar
  • 203
3 votes
3 answers
368 views

It is just one of the files. I have also tried to write some tests using PHPUnit. Please give me some suggestions to improve my coding-writing skills. The below is the test file for the above file: <...
Karthikeyan Palaniswamy's user avatar
2 votes
1 answer
453 views

I'm studying design patterns and I made this car store implementation. Although I'm confident that the idea is right, I'm not confident that the implementation is good. I would like you to check it ...
yayuj's user avatar
  • 185
4 votes
1 answer
354 views

I implemented the Simple Factory Pattern with some unit tests, but I'm with a feeling that I did something wrong and that I can improve it. Tell me what you think about the code (source and tests). ...
yayuj's user avatar
  • 185
3 votes
0 answers
898 views

So I'm using laravel for a project and have a InvoiceRepository and a InvoiceRepositoryTest and I have written the test first ...
toonevdb's user avatar
  • 131
2 votes
1 answer
7k views

I ran into some issues with unit testing in that getting the response body etc from the curl handle was tricky. I didn't want to necessarily use a mock or abstract the curl functionality. A colleague ...
ajameswolf's user avatar
5 votes
1 answer
502 views

I've just created my first tests using mock classes. So far my tests are running much faster and now I guess I'm solely focusing on a single class (in this case I'm testing UserTable and mocking the ...
Martyn's user avatar
  • 233
3 votes
1 answer
1k views

No one in my team knows how to write BDD tests, so I started writing some and it's quite working well. I think the time has come to improve the code quality. This contains a lot of duplicated code ...
Matthias Guenther's user avatar