PHPackages                             devel0pmenthero/crash - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. devel0pmenthero/crash

ActiveLibrary

devel0pmenthero/crash
=====================

A small library for unit- and pentesting code.

1.0.0(4y ago)06MITPHP

Since Jun 23Pushed 4y ago1 watchersCompare

[ Source](https://github.com/Devel0pmentHero/Crash)[ Packagist](https://packagist.org/packages/devel0pmenthero/crash)[ RSS](/packages/devel0pmenthero-crash/feed)WikiDiscussions main Synced today

READMEChangelog (1)DependenciesVersions (2)Used By (0)

Crash
=====

[](#crash)

A small unit- and pentest library for PHP.

Installation
------------

[](#installation)

`composer require devel0pmenthero/crash`

Usage
-----

[](#usage)

Note: Any parameters can be specified with a leading capital letter.

### Generating tests

[](#generating-tests)

#### Single classes

[](#single-classes)

```
Crash::Create(Subject::class, true, false);
```

```
php Crash.php -c[--create] --class="Subject"
```

#### Directories

[](#directories)

```
Crash::CreateFromPath("./targetdir", true, false);
```

```
php Crash.php -c[--create] -p[--path]="./targetdir"
```

Inherited methods can be included via passing an optional "inherit"-parameter.

```
php Crash.php -c[--create] -p[--path]="" -i[--inherit]
```

Existing test classes can be overwritten by passing an optional "overwrite"-parameter.

```
php Crash.php -c[--create] -p[--path]="" -o[--overwrite]
```

### Running tests

[](#running-tests)

```
Crash::Test("./targetdir");
```

```
php Crash.php -t[--test] -p[--path]="./targetdir"
```

Omitting the path will default to the path stored in the public `Crash::Tests` constant.

Attributes
----------

[](#attributes)

Crash allows the user to control the execution of specific tests via defining custom attributes. While generating Crash\\Tests from existing source, the library will copy over any existing (Crash-)Attributes to the final test classes.

### Repeat

[](#repeat)

`#[Repeat(Amount: int, Interval: int)]`

The "Repeat"-Attribute allows to execute a test case multiple times in an optional specified interval of microseconds.

### Crash

[](#crash-1)

`#[Crash(Amount: int, Interval: int)]`

The "Crash"-Attribute acts like the former one but passes a random amount of random values to the desired test case instead.

### Values

[](#values)

`#[Values(Random: int, Interval: int, ...$Values)]`

The "Values"-Attribute allows specifying custom values being passed as parameters to the desired test case. Alternatively, the Attribute can generate a specified random amount of values.

### Skip

[](#skip)

`#[Skip]`

The "Skip"-Attribute simply instructs the library to skip the test- or case.

### Writing Tests

[](#writing-tests)

Test are simple php classes and must be located in the "Crash\\Tests"-namespace to be recognized as a test.

```
