From 1ccb112e40bcbae32f6f3a2fb2c4ba876fe9b937 Mon Sep 17 00:00:00 2001 From: Vincenzo Petrucci Date: Wed, 6 Dec 2023 11:29:01 +0100 Subject: [PATCH] feat(methods): adds unit test for Factory class --- tests/Unit/Factory.php | 72 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 tests/Unit/Factory.php diff --git a/tests/Unit/Factory.php b/tests/Unit/Factory.php new file mode 100644 index 0000000..59867fe --- /dev/null +++ b/tests/Unit/Factory.php @@ -0,0 +1,72 @@ +stress->method())->toBe('get'); +}); + +it('correctly sets the delete method', function() { + $this->stress->delete(); + + expect($this->stress->method())->toBe('delete'); +}); + +it('correctly sets the get method', function() { + $this->stress->get(); + + expect($this->stress->method())->toBe('get'); +}); + +it('correctly sets the head method', function() { + $this->stress->head(); + + expect($this->stress->method())->toBe('head'); +}); + +it('correctly sets the options method without payload', function() { + $this->stress->options(); + + expect($this->stress->method())->toBe('options') + ->and($this->stress->payload())->toBe([]); +}); + +it('correctly sets the options method with payload', function() { + $this->stress->options(['foo' => 'bar']); + + expect($this->stress->method())->toBe('options') + ->and($this->stress->payload())->toBe(['foo' => 'bar']); +}); + +it('correctly sets the patch method without payload', function() { + $this->stress->patch(); + + expect($this->stress->method())->toBe('patch') + ->and($this->stress->payload())->toBe([]); +}); + +it('correctly sets the patch method with payload', function() { + $this->stress->patch(['foo' => 'bar']); + + expect($this->stress->method())->toBe('patch') + ->and($this->stress->payload())->toBe(['foo' => 'bar']); +}); + +it('correctly sets the put method without payload', function() { + $this->stress->put(); + + expect($this->stress->method())->toBe('put') + ->and($this->stress->payload())->toBe([]); +}); + +it('correctly sets the put method with payload', function() { + $this->stress->put(['foo' => 'bar']); + + expect($this->stress->method())->toBe('put') + ->and($this->stress->payload())->toBe(['foo' => 'bar']); +}); + +it('correctly sets the post method', function() { + $this->stress->post(['foo' => 'bar']); + + expect($this->stress->method())->toBe('post') + ->and($this->stress->payload())->toBe(['foo' => 'bar']); +}); \ No newline at end of file