1. Go to this page and download the library: Download sandstorm/fuzzer library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
sandstorm / fuzzer example snippets
php
class Foo {
protected $someInternalState = 0;
public function someMethod() {
$this->someInternalState++;
return 42;
}
public function getInternalState() {
return $this->someInternalState;
}
}
php
/**
* @test
*/
public function someTest() {
$myObject = new Foo();
$this->assertSame(42, $myObject->someMethod());
}
/**
* @test
*/
public function someOtherTest() {
$myObject = new Foo();
$this->assertSame(0, $myObject->someInternalState());
}
Unmodified unit tests took 1 seconds, setting timeout to 3 seconds (to be safe).
Generating and Testing Mutations:
_.__.._..._.___....__.E._._..._..._.__.E._...._..E__.__.._.._.._E_.___._.___...E_.._._._..._.T._..._
Undetected Mutations
--------------------
Classes/Domain/Model/FooBar.php
Package: TYPO3.FooBar
Diff follows below
diff --git a/Classes/Domain/Model/FooBar.php b/Classes/Domain/Model/FooBar.php
index 8fde46c..bee58d7 100644
--- a/Classes/Domain/Model/FooBar.php
+++ b/Classes/Domain/Model/FooBar.php
@@ -107,7 +107,7
public function registerIfPossible() {
- parent::registerIfPossible();
+# parent::registerIfPossible();
foreach ($this->elements as $element) {
$element->doStuff();
}
... output for all other undetected mutations ...
Fuzzing Statistics
------------------
Total Mutations: 253
Mutations with Broken Syntax: 120
Detected Mutations: 127
Undetected mutations: 6 (see above for details)
Total Runtime: 61 s
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.