# Command

Use this assertion type to run any free command and verify its output with your expected value.

This is based on "string contains" assertions.

## Expecting

Use this type of assertion to verify against an expected output of the command.

```yaml
commands:
  - name: "NVM can switch Node version"
    command: "nvm use 14 && echo SVRUNIT: $(node -v)"
    expected: "SVRUNIT: v14."
```

## Not Expecting

Use this type if you do not want your output to show the provided value.

```yaml
commands:
  - name: "Xdebug not Corrupted"
    command: "php -v"
    not_expected: "zend_mm_heap corrupted"
```

## Expecting AND conditions

Use this type if you do not want your output to show the provided value.

```yaml
commands:
  - name: "Verify PHP 7.4 and OPcache v7.4"
    command: "php -v"
    expected_and:
      - "PHP 7.4"
      - "OPcache v7.4"
```

## Expecting OR conditions

Use this type if you do not want your output to show the provided value.

```yaml
commands
  - name: "Verify any of the allowed PHP versions"
    command: "php -v"
    expected_or:
      - "PHP 8.1"
      - "PHP 8.0"
      - "PHP 7.4"
```

## Setup / Teardown

This test also offers separate command options as setup and teardown routine.\
Commands provided with these options, will be run prior and/or after the actual command of this test.

```
commands:
  - name: "..."
    command: "...."
    expected: "..."
    setup: "mkdir -p test_assets"
    teardown: "rm -f test_assets"
```
