LaravelPackages.net
Acme Inc.
Toggle sidebar
henrotaym/laravel-test-suite

Adding recurrent functionalities to laravel test suite.

9.418
0
v3.0.2
About henrotaym/laravel-test-suite

henrotaym/laravel-test-suite is a Laravel package for adding recurrent functionalities to laravel test suite.. It currently has 0 GitHub stars and 9.418 downloads on Packagist (latest version v3.0.2). Install it with composer require henrotaym/laravel-test-suite. Discover more Laravel packages by henrotaym or browse all Laravel packages to compare alternatives.

Last updated

Laravel test suite

Compatibility

| Laravel | Package | |---|---| | 8.x / 9.x | 2.x | | 12.x | 3.x |

Installation

composer require henrotaym/laravel-test-suite

Configuration

Your TestCase should use this trait :

Henrotaym\LaravelTestSuite\TestSuite

Functionalities

Mocking

/**
* Mocking given element.
* 
* @param  string $element Element to mock
* @return  MockInterface
*/
protected  function  mockThis(string  $element,  bool  $is_partial  = false):  MockInterface

Getting private property

/**
 * Getting private property value from given instance.
 * 
 * @param string $property Property we're trying to access to.
 * @param mixed $instance Instance where we access property.
 * @return mixed Property value.
 */
protected function getPrivateProperty(string $property, $instance);

Setting private property

/**
 * Setting private property value in given instance.
 * 
 * @param string $property Property we're trying to access to.
 * @param mixed $value Value to set.
 * @param mixed $instance Instance where we set value.
 * @return mixed Instance in order to chain potential calls.
 */
protected function setPrivateProperty(string $property, $value, $instance);

Calling private method

/**
 * Calling private method from given instance.
 * 
 * @param string $method Method we're trying to access to.
 * @param mixed $instance Instance where we access method.
 * @param mixed $parameters Arguments to give to method.
 * @return mixed Method return value.
 */
protected function callPrivateMethod(string $method, $instance, ...$parameters);

Mocking Carbon now helper

/**
 * Mocking Carbon now helper.
 * 
 * @param Carbon $now Expected time returned when calling now().
 * @return static
 */
public function mockCarbonNow(Carbon $now)
Comments