Skip to content

Commit

Permalink
CS Fixes & additional validation during tests (#145)
Browse files Browse the repository at this point in the history
* CS Fixes & additional validation during tests

* Added php 7.3
  • Loading branch information
norberttech authored Jan 29, 2019
1 parent fc2a8be commit 44ba53e
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 7 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ matrix:
env: DEPENDENCIES='low'
- php: 7.1
- php: 7.2
- php: 7.3

before_install:
- composer self-update
Expand All @@ -23,3 +24,4 @@ install:

script:
- ./bin/phpunit
- ./bin/php-cs-fixer fix -v --dry-run
2 changes: 1 addition & 1 deletion src/Matcher/Pattern/Expander/After.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ final class After implements PatternExpander


public function __construct($boundary)
{
{
if (false === \is_string($boundary)) {
$this->error = \sprintf('After expander require "string", got "%s".', new StringConverter($boundary));
return false;
Expand Down
2 changes: 1 addition & 1 deletion src/Matcher/Pattern/Expander/Before.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public static function is(string $name) : bool
}

public function match($value) : bool
{
{
if (!\is_string($value)) {
$this->error = \sprintf('Before expander require "string", got "%s".', new StringConverter($value));
return false;
Expand Down
2 changes: 1 addition & 1 deletion src/Matcher/Pattern/Expander/NotContains.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function match($value) : bool
: \mb_strpos($value, $this->string);

if ($contains !== false) {
$this->error = \sprintf("String \"%s\" contains \"%s\".", $value, $this->string);
$this->error = \sprintf('String "%s" contains "%s".', $value, $this->string);

return false;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function parse(string $pattern) : Pattern\TypePattern

public function getAST(string $pattern) : AST\Pattern
{
if($pattern === '') {
if ($pattern === '') {
return new AST\Pattern(new AST\Type(''));
}

Expand Down
3 changes: 1 addition & 2 deletions tests/Matcher/Pattern/Expander/NotContainsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace Coduo\PHPMatcher\Tests\Matcher\Pattern\Expander;

use Coduo\PHPMatcher\Matcher\Pattern\Expander\Contains;
use Coduo\PHPMatcher\Matcher\Pattern\Expander\NotContains;
use PHPUnit\Framework\TestCase;

Expand Down Expand Up @@ -61,7 +60,7 @@ public function test_error_when_matching_fail($string, $value, $errorMessage)
public static function invalidCasesProvider()
{
return [
['ipsum', 'lorem ipsum', "String \"lorem ipsum\" contains \"ipsum\"."],
['ipsum', 'lorem ipsum', 'String "lorem ipsum" contains "ipsum".'],
['lorem', new \DateTime(), 'Not contains expander require "string", got "\\DateTime".'],
];
}
Expand Down
2 changes: 1 addition & 1 deletion tests/MatcherTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ public static function expanderExamples()
['lorem ipsum', '@[email protected]()', false],
['2014-08-19', '@[email protected]()', true],
['3014-08-19', '@[email protected]("today")', false],
['1014-08-19', '@[email protected]("+ 1day")', true],
['1014-08-19', '@[email protected]("+ 1day")', true],
['3014-08-19', '@[email protected]("today")', true],
['1014-08-19', '@[email protected]("+ 1day")', false],
[100, '@[email protected](101).greaterThan(10)', true],
Expand Down

0 comments on commit 44ba53e

Please sign in to comment.