-
-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/master'
Conflicts: src/JsonMatcher/Matcher.php src/JsonMatcher/Matcher/ScalarMatcher.php tests/JsonMatcher/ArrayMatcherTest.php
- Loading branch information
Showing
9 changed files
with
43 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,4 @@ public function canMatch($pattern) | |
{ | ||
return true; | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,7 +35,6 @@ public function canMatch($pattern) | |
return true; | ||
} | ||
|
||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
namespace JsonMatcher\Matcher; | ||
|
||
class WildcardMatcher implements PropertyMatcher | ||
{ | ||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public function match($matcher, $pattern) | ||
{ | ||
return true; | ||
} | ||
|
||
public function canMatch($pattern) | ||
{ | ||
return '*' === $pattern; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,4 +23,4 @@ | |
} | ||
|
||
return false; | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<?php | ||
<?php | ||
namespace JsonMatcher\Tests; | ||
|
||
use JsonMatcher\Matcher\ArrayMatcher; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,10 @@ | ||
<?php | ||
<?php | ||
namespace JsonMatcher\Tests; | ||
|
||
use JsonMatcher\Matcher; | ||
|
||
class MatcherTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
public function test_foo() | ||
{ | ||
$this->assertTrue(true); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,17 @@ | ||
<?php | ||
namespace JsonMatcher\Tests; | ||
|
||
use JsonMatcher\Matcher\TypeMatcher; | ||
use JsonMatcher\Matcher\WildcardMatcher; | ||
|
||
class TypeMatcherTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
|
||
public function test_type_placeholders() | ||
{ | ||
$matcher = new TypeMatcher(); | ||
$matcher = new WildcardMatcher(); | ||
$this->assertTrue($matcher->match(1, "@integer")); | ||
$this->assertTrue($matcher->match("michal", "@string")); | ||
$this->assertTrue($matcher->match(false, "@boolean")); | ||
$this->assertTrue($matcher->match(6.66, "@double")); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
namespace JsonMatcher\Tests; | ||
|
||
use JsonMatcher\Matcher\WildcardMatcher; | ||
|
||
class WildcardMatcherTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
|
||
public function test_type_placeholders() | ||
{ | ||
$matcher = new WildcardMatcher(); | ||
$this->assertTrue($matcher->match('*', "@integer")); | ||
$this->assertTrue($matcher->match("*", "foobar")); | ||
$this->assertTrue($matcher->match("*", true)); | ||
$this->assertTrue($matcher->match("*", 6.66)); | ||
} | ||
} |