Skip to content

Commit

Permalink
FuncProxy methods incorrectly override parent class methods. Fix #41
Browse files Browse the repository at this point in the history
  • Loading branch information
DavertMik committed Oct 15, 2014
1 parent 66264df commit fc6884f
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 11 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

#### 0.5.1

* Fixed strict errors for func verifier *2014-10-16*


#### 0.5.0

* test::ns() method removed *2014-10-10*
Expand Down
2 changes: 2 additions & 0 deletions RoboFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ public function release()
->uri('Codeception/AspectMock')
->askDescription()
->run();

$this->bump();
}

public function docs()
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.5.0
0.5.1
21 changes: 11 additions & 10 deletions src/AspectMock/Proxy/FuncProxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,46 +23,47 @@
* ```
*
*/
class FuncProxy extends Verifier
class FuncProxy
{
protected $func;
protected $ns;
protected $fullFuncName;

/**
* @var FuncVerifier
*/
protected $funcVerifier;

public function __construct($namespace, $func)
{
$this->func = $func;
$this->ns = $namespace;
$this->fullFuncName = $namespace . '/' . $func;
}

protected function callSyntax($method)
{
return "";
$this->funcVerifier = new FuncVerifier($namespace);
}

/**
* @param null $params
*/
public function verifyInvoked($params = null)
{
parent::verifyInvoked($this->func, $params);
$this->funcVerifier->verifyInvoked($this->func, $params);
}

/**
* @param null $params
*/
public function verifyInvokedOnce($params = null)
{
$this->verifyInvokedMultipleTimes(1, $params);
$this->funcVerifier->verifyInvokedMultipleTimes($this->func, 1, $params);
}

/**
* @param null $params
*/
public function verifyNeverInvoked($params = null)
{
parent::verifyNeverInvoked($this->func, $params);
$this->funcVerifier->verifyNeverInvoked($this->func, $params);
}

/**
Expand All @@ -71,7 +72,7 @@ public function verifyNeverInvoked($params = null)
*/
public function verifyInvokedMultipleTimes($times, $params = null)
{
parent::verifyInvokedMultipleTimes($this->func, $times, $params);
$this->funcVerifier->verifyInvokedMultipleTimes($this->func, $times, $params);
}

/**
Expand Down
27 changes: 27 additions & 0 deletions src/AspectMock/Proxy/FuncVerifier.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php
namespace AspectMock\Proxy;

use AspectMock\Core\Registry;

class FuncVerifier extends Verifier
{
protected $ns;

public function __construct($namespace)
{
$this->ns = $namespace;
}

protected function callSyntax($method)
{
return "";
}

public function getCallsForMethod($func)
{
$calls = Registry::getFuncCallsFor($this->ns . '\\' . $func);
return $calls;
}


}

0 comments on commit fc6884f

Please sign in to comment.