Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report
Generated on May 7, 2024 via composer

codeception/stub 4.1.3

Flexible Stub wrapper for PHPUnit's Mock Builder
Package summary
Share
0
issues
2
licenses
25
BSD-3-Clause
2
MIT
Package created
10 Jan 2018
Version published
2 Feb 2024
Maintainers
2
Total deps
27
Direct deps
1
License
MIT

Issues

0
This package has no issues

Licenses

BSD 3-Clause "New" or "Revised" License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
place-warranty
Cannot
use-trademark
hold-liable
Must
include-copyright
include-license
25 Packages, Including:
nikic/php-parser@v5.0.2
phar-io/manifest@2.0.4
phar-io/version@3.2.1
phpunit/php-code-coverage@11.0.3
phpunit/php-file-iterator@5.0.0
phpunit/php-invoker@5.0.0
phpunit/php-text-template@4.0.0
phpunit/php-timer@7.0.0
phpunit/phpunit@11.1.3
sebastian/cli-parser@3.0.1
sebastian/code-unit@3.0.0
sebastian/code-unit-reverse-lookup@4.0.0
sebastian/comparator@6.0.0
sebastian/complexity@4.0.0
sebastian/diff@6.0.1
sebastian/environment@7.1.0
sebastian/exporter@6.0.1
sebastian/global-state@7.0.1
sebastian/lines-of-code@3.0.0
sebastian/object-enumerator@6.0.0
sebastian/object-reflector@4.0.0
sebastian/recursion-context@6.0.0
sebastian/type@5.0.0
sebastian/version@5.0.0
theseer/tokenizer@1.2.3

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
2 Packages, Including:
codeception/stub@4.1.3
myclabs/deep-copy@1.11.1
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

1
All Dependencies CSV
β“˜ This is a list of codeception/stub 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities
phpunit/phpunit11.1.3-BSD-3-Clause
prod dev

Visualizations

Frequently Asked Questions

What does codeception/stub do?

Codeception\Stub is a PHP package designed to provide a simplified wrapper for PHPUnit's Mock Builder. This invaluable tool is a vital addition to the PHP developer's toolbox, designed to create stub classes using static methods, as well as mocks through a stub trait. Through the use of this package, developers can streamline and enhance their development and testing processes.

How do you use codeception/stub?

To utilize the benefits of Codeception\Stub, you need to install it first. If you are using PHPUnit, simply run the command composer require codeception/stub --dev in your terminal. Once installed, the Stub package can be used to create Stubs and Mocks.

Here are a few examples of how to use the Codeception\Stub:

// Assume we have a UserRepository class and a User class
// Create a stub with 'find' method replaced
$userRepository = Stub::make(UserRepository::class, ['find' => new User]);
$userRepository->find(1); // => Returns User

// Create a dummy UserRepository
$userRepository = Stub::makeEmpty(UserRepository::class);

// Create a stub with all methods replaced except 'validate'
$user = Stub::makeEmptyExcept(User::class, 'validate');
$user->validate($data);

For more fine-grained control, you can utilize the Stub Trait methods to replace, mock and interact with classes:

// Create method expectation where 'find' method should be never called
$userRepository = $this->make(UserRepository::class, [
    'find' => Codeception\Stub\Expected::never()
]);

Where are the codeception/stub docs?

The documentation for the codeception/stub package can be found at the GitHub repository. For comprehensive insights into the workings of the stub, check the Stub.md file. For information on creating stubs and mocks using trait, consult the StubTrait.md file. To define expectations for mocks, the Expected.md file is your go-to guide.