Skip to content

Commit

Permalink
Change the php exclusion tag name pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
jakzal committed Dec 31, 2018
1 parent 2e07da9 commit 2c60e6f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ To exclude some tools from the listing multiple `--exclude-tag` options can be a
The `--tag` option can be used to filter tools by tags.

```
bin/toolbox.php list-tools --exclude-tag ~php7.3 --exclude-tag foo --tag bar
bin/toolbox.php list-tools --exclude-tag exclude-php:7.3 --exclude-tag foo --tag bar
```

### Install tools
Expand Down Expand Up @@ -132,7 +132,7 @@ To exclude some tools from the installation multiple `--exclude-tag` options can
The `--tag` option can be used to filter tools by tags.

```
bin/toolbox.php install --exclude-tag ~php7.3 --exclude-tag foo --tag bar
bin/toolbox.php install --exclude-tag exclude-php:7.3 --exclude-tag foo --tag bar
```

### Test if installed tools are usable
Expand All @@ -155,7 +155,7 @@ To exclude some tools from the generated test command multiple `--exclude-tag` o
The `--tag` option can be used to filter tools by tags.

```
bin/toolbox.php test --exclude-tag ~php7.3 --exclude-tag foo --tag bar
bin/toolbox.php test --exclude-tag exclude-php:7.3 --exclude-tag foo --tag bar
```

### Tools definitions
Expand All @@ -180,4 +180,4 @@ Tools can be tagged in order to enable grouping and filtering them.
The tags below have a special meaning:

* `pre-installation` - these tools will be installed before any other tools.
* `~php7.3`, `~php7.1` etc - used to exclude installation on the specified php version.
* `exclude-php:7.3`, `exclude-php:7.1` etc - used to exclude installation on the specified php version.
2 changes: 1 addition & 1 deletion resources/tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@
}
},
"test": "php-cs-fixer list",
"tags": ["~php7.3"]
"tags": ["exclude-php:7.3"]
},
{
"name": "php-formatter",
Expand Down
16 changes: 8 additions & 8 deletions tests/Tool/FilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ public function test_it_returns_true_if_no_excluded_tags_were_defined()

public function test_it_returns_true_if_no_excluded_tags_match()
{
$filter = new Filter(['~php:7.3'], []);
$filter = new Filter(['exclude-php:7.3'], []);

$this->assertTrue($filter($this->tool(['phpspec', 'phpstan'])));
}

public function test_it_returns_true_if_tool_has_no_tags()
{
$filter = new Filter(['~php:7.3'], []);
$filter = new Filter(['exclude-php:7.3'], []);

$this->assertTrue($filter($this->tool([])));
}
Expand All @@ -38,23 +38,23 @@ public function test_it_returns_true_if_neither_tool_nor_excluded_tags_were_defi

public function test_it_returns_false_if_one_excluded_tag_matches()
{
$filter = new Filter(['~php:7.3'], []);
$filter = new Filter(['exclude-php:7.3'], []);

$this->assertFalse($filter($this->tool(['phpspec', 'phpstan', '~php:7.3'])));
$this->assertFalse($filter($this->tool(['phpspec', 'phpstan', 'exclude-php:7.3'])));
}

public function test_it_returns_false_if_multiple_excluded_tags_match()
{
$filter = new Filter(['~php:7.3', 'phpstan'], []);
$filter = new Filter(['exclude-php:7.3', 'phpstan'], []);

$this->assertFalse($filter($this->tool(['phpspec', 'phpstan', '~php:7.3'])));
$this->assertFalse($filter($this->tool(['phpspec', 'phpstan', 'exclude-php:7.3'])));
}

public function test_it_returns_false_if_all_excluded_tags_match()
{
$filter = new Filter(['~php:7.3', 'phpspec', 'phpstan'], []);
$filter = new Filter(['exclude-php:7.3', 'phpspec', 'phpstan'], []);

$this->assertFalse($filter($this->tool(['phpspec', 'phpstan', '~php:7.3'])));
$this->assertFalse($filter($this->tool(['phpspec', 'phpstan', 'exclude-php:7.3'])));
}

public function test_it_returns_true_if_a_tag_matches()
Expand Down

0 comments on commit 2c60e6f

Please sign in to comment.