From 733c4e352b222044030bfd95a49cc3bbcc600855 Mon Sep 17 00:00:00 2001 From: grandeljay Date: Wed, 20 Sep 2023 16:59:51 +0200 Subject: [PATCH] test: add create wish --- tests/CreateWishTest.php | 53 ++++++++++++++++++++++++++++++++++++++++ tests/README.md | 5 ++++ 2 files changed, 58 insertions(+) create mode 100644 tests/CreateWishTest.php create mode 100644 tests/README.md diff --git a/tests/CreateWishTest.php b/tests/CreateWishTest.php new file mode 100644 index 00000000..6ad61265 --- /dev/null +++ b/tests/CreateWishTest.php @@ -0,0 +1,53 @@ +apiRequest( + 'http://wishthis.online.localhost/api/wishes', + 'POST', + array( + 'wish_title' => 'WD Red SA500 NAS SATA SSD 2TB 2.5": Amazon.de: Computer & Accessories', + 'wishlist_id' => $this->testWishlistId, + ) + ); + + $this->assertNotFalse($apiResponse); + + $json = \json_decode($apiResponse, true); + $this->assertNotNull($json); + $this->assertTrue($json['success']); + $this->assertEmpty($json['warning'], 'There has been unexpected output.'); + } +} diff --git a/tests/README.md b/tests/README.md new file mode 100644 index 00000000..5d6114cf --- /dev/null +++ b/tests/README.md @@ -0,0 +1,5 @@ +# Tests + +## Running test + +All tests can be run by executing `/vendor/bin/phpunit tests --testdox`.