{"repo":"lchrusciel/ApiTestCase","free":true,"listed":false,"github":"https://github.com/lchrusciel/ApiTestCase","clone":"git clone https://github.com/lchrusciel/ApiTestCase.git","description":"Handy PHPUnit test case for testing JSON APIs in your Symfony applications.","language":"PHP","stars":412,"topics":["hacktoberfest","api","php","phpunit"],"license":"MIT","category":"api-integrations-sdks","readme_excerpt":"ApiTestCase =========== ApiTestCase is a PHPUnit TestCase that will make your life as a Symfony API developer much easier. It extends basic Symfony WebTestCase with some cool features. Thanks to PHP-Matcher you can, according to its readme, \"write expected json responses like a gangster\". We definitely agree. It also uses Alice for easy Doctrine fixtures loading. Features: Clear TDD workflow for API development with Symfony; JSON/XML matching with clear error messages; Fixtures loading with Alice (optional) ; Installation ------------ Assuming you already have Composer installed globally: And it's done! ApiTestCase is working with the default configuration. Usage ----- We provide two base classes for your test cases: JsonApiTestCase and the XmlApiTestCase. Choose one based on the format of the API you want to create. Json Example The basic TDD workflow is the following: 1. Write a test case that sends the request and use assertResponse assertion method to check if response contents are matching your expectations. You need a name for the response file; 2. Create the file with name that you picked in step 1. and put expected response contents there. It should be put in src/AppBundle/Tests/Responses/Expected/hello world.json for example. 3. Make it red. 4. Make it green. 5. Refactor. Let's see a simple example! Write the following test: Now define the expected response file: Run your tests: Your test should fail with some errors, you are probably missing the controller and routi","default_branch":null,"files":null,"tree":[],"storefront":"/r/lchrusciel","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/lchrusciel/ApiTestCase/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}