Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
Conflicts:
	src/JsonMatcher/Matcher.php
	src/JsonMatcher/Matcher/ScalarMatcher.php
	tests/JsonMatcher/ArrayMatcherTest.php
  • Loading branch information
norberttech committed Apr 15, 2014
2 parents 70d8562 + 1c961e3 commit 24b7a9d
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 13 deletions.
2 changes: 0 additions & 2 deletions src/JsonMatcher/Matcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,4 @@ public function canMatch($pattern)
{
return true;
}


}
1 change: 0 additions & 1 deletion src/JsonMatcher/Matcher/ArrayMatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ public function canMatch($pattern)
return is_array($pattern);
}


private function buildPath(array $array, $parentPath)
{
foreach ($array as $key => $element) {
Expand Down
1 change: 0 additions & 1 deletion src/JsonMatcher/Matcher/ChainMatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ public function canMatch($pattern)
return true;
}


/**
* {@inheritDoc}
*/
Expand Down
20 changes: 20 additions & 0 deletions src/JsonMatcher/Matcher/WildcardMatcher.php
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;
}

}
2 changes: 1 addition & 1 deletion src/autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@
}

return false;
});
});
2 changes: 1 addition & 1 deletion tests/JsonMatcher/ArrayMatcherTest.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php
namespace JsonMatcher\Tests;

use JsonMatcher\Matcher\ArrayMatcher;
Expand Down
6 changes: 2 additions & 4 deletions tests/JsonMatcher/MatcherTest.php
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);
}
}
}
5 changes: 2 additions & 3 deletions tests/JsonMatcher/PlaceholderMatcherTest.php
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"));
}
}

17 changes: 17 additions & 0 deletions tests/JsonMatcher/WildcardMatcherTest.php
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));
}
}

0 comments on commit 24b7a9d

Please sign in to comment.