Skip to content

Commit

Permalink
feat(methods): adds unit test for Factory class
Browse files Browse the repository at this point in the history
  • Loading branch information
nahime0 committed Dec 6, 2023
1 parent 7fde60e commit 1ccb112
Showing 1 changed file with 72 additions and 0 deletions.
72 changes: 72 additions & 0 deletions tests/Unit/Factory.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<?php

it('correctly use get method by default', function() {
expect($this->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']);
});

0 comments on commit 1ccb112

Please sign in to comment.