for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace WNBY\Tests;
use WNBY\ParserFunctionFactory;
/**
* @covers \WNBY\ParserFunctionFactory
* @group whats-nearby
*
* @license GNU GPL v2+
* @since 1.0
* @author mwjames
*/
class ParserFunctionFactoryTest extends \PHPUnit_Framework_TestCase {
public function testCanConstruct() {
$this->assertInstanceOf(
'\WNBY\ParserFunctionFactory',
new ParserFunctionFactory()
);
}
public function testCanConstructNearByParserFunctionDefinition() {
$instance = new ParserFunctionFactory();
list( $name, $definition, $flag ) = $instance->newNearbyParserFunctionDefinition();
$flag
list($first,,$third)
This checks looks for assignemnts to variables using the list(...) function, where not all assigned variables are subsequently used.
list(...)
Consider the following code example.
<?php function returnThreeValues() { return array('a', 'b', 'c'); } list($a, $b, $c) = returnThreeValues(); print $a . " - " . $c;
Only the variables $a and $c are used. There was no need to assign $b.
$a
$c
$b
Instead, the list call could have been.
list($a,, $c) = returnThreeValues();
$this->assertEquals(
'nearby',
$name
'\Closure',
$definition
$parserOutput = $this->getMockBuilder( '\ParserOutput' )
->disableOriginalConstructor()
->getMock();
$parser = $this->getMockBuilder( '\Parser' )
$parser->expects( $this->any() )
->method( 'getOutput' )
->will( $this->returnValue( $parserOutput ) );
$this->assertNotEmpty(
call_user_func_array( $definition, array( $parser ) )
This checks looks for assignemnts to variables using the
list(...)
function, where not all assigned variables are subsequently used.Consider the following code example.
Only the variables
$a
and$c
are used. There was no need to assign$b
.Instead, the list call could have been.