Upgraded to KH 3.3.0
This commit is contained in:
298
includes/kohana/vendor/phpunit/php-code-coverage/Tests/PHP/CodeCoverage/FilterTest.php
vendored
Normal file
298
includes/kohana/vendor/phpunit/php-code-coverage/Tests/PHP/CodeCoverage/FilterTest.php
vendored
Normal file
@@ -0,0 +1,298 @@
|
||||
<?php
|
||||
/**
|
||||
* PHP_CodeCoverage
|
||||
*
|
||||
* Copyright (c) 2009-2012, Sebastian Bergmann <sb@sebastian-bergmann.de>.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* * Neither the name of Sebastian Bergmann nor the names of his
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @category PHP
|
||||
* @package CodeCoverage
|
||||
* @subpackage Tests
|
||||
* @author Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @copyright 2009-2012 Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
|
||||
* @link http://github.com/sebastianbergmann/php-code-coverage
|
||||
* @since File available since Release 1.0.0
|
||||
*/
|
||||
|
||||
if (!defined('TEST_FILES_PATH')) {
|
||||
define(
|
||||
'TEST_FILES_PATH',
|
||||
dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR .
|
||||
'_files' . DIRECTORY_SEPARATOR
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests for the PHP_CodeCoverage_Filter class.
|
||||
*
|
||||
* @category PHP
|
||||
* @package CodeCoverage
|
||||
* @subpackage Tests
|
||||
* @author Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @copyright 2009-2012 Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
|
||||
* @link http://github.com/sebastianbergmann/php-code-coverage
|
||||
* @since Class available since Release 1.0.0
|
||||
*/
|
||||
class PHP_CodeCoverage_FilterTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected $filter;
|
||||
protected $files;
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
$this->filter = unserialize('O:23:"PHP_CodeCoverage_Filter":0:{}');
|
||||
|
||||
$this->files = array(
|
||||
TEST_FILES_PATH . 'BankAccount.php',
|
||||
TEST_FILES_PATH . 'BankAccountTest.php',
|
||||
TEST_FILES_PATH . 'CoverageClassExtendedTest.php',
|
||||
TEST_FILES_PATH . 'CoverageClassTest.php',
|
||||
TEST_FILES_PATH . 'CoverageFunctionTest.php',
|
||||
TEST_FILES_PATH . 'CoverageMethodOneLineAnnotationTest.php',
|
||||
TEST_FILES_PATH . 'CoverageMethodTest.php',
|
||||
TEST_FILES_PATH . 'CoverageNoneTest.php',
|
||||
TEST_FILES_PATH . 'CoverageNotPrivateTest.php',
|
||||
TEST_FILES_PATH . 'CoverageNotProtectedTest.php',
|
||||
TEST_FILES_PATH . 'CoverageNotPublicTest.php',
|
||||
TEST_FILES_PATH . 'CoverageNothingTest.php',
|
||||
TEST_FILES_PATH . 'CoveragePrivateTest.php',
|
||||
TEST_FILES_PATH . 'CoverageProtectedTest.php',
|
||||
TEST_FILES_PATH . 'CoveragePublicTest.php',
|
||||
TEST_FILES_PATH . 'CoverageTwoDefaultClassAnnotations.php',
|
||||
TEST_FILES_PATH . 'CoveredClass.php',
|
||||
TEST_FILES_PATH . 'CoveredFunction.php',
|
||||
TEST_FILES_PATH . 'NamespaceCoverageClassExtendedTest.php',
|
||||
TEST_FILES_PATH . 'NamespaceCoverageClassTest.php',
|
||||
TEST_FILES_PATH . 'NamespaceCoverageCoversClassPublicTest.php',
|
||||
TEST_FILES_PATH . 'NamespaceCoverageCoversClassTest.php',
|
||||
TEST_FILES_PATH . 'NamespaceCoverageMethodTest.php',
|
||||
TEST_FILES_PATH . 'NamespaceCoverageNotPrivateTest.php',
|
||||
TEST_FILES_PATH . 'NamespaceCoverageNotProtectedTest.php',
|
||||
TEST_FILES_PATH . 'NamespaceCoverageNotPublicTest.php',
|
||||
TEST_FILES_PATH . 'NamespaceCoveragePrivateTest.php',
|
||||
TEST_FILES_PATH . 'NamespaceCoverageProtectedTest.php',
|
||||
TEST_FILES_PATH . 'NamespaceCoveragePublicTest.php',
|
||||
TEST_FILES_PATH . 'NamespaceCoveredClass.php',
|
||||
TEST_FILES_PATH . 'NotExistingCoveredElementTest.php',
|
||||
TEST_FILES_PATH . 'source_with_ignore.php',
|
||||
TEST_FILES_PATH . 'source_with_namespace.php',
|
||||
TEST_FILES_PATH . 'source_with_oneline_annotations.php',
|
||||
TEST_FILES_PATH . 'source_without_ignore.php',
|
||||
TEST_FILES_PATH . 'source_without_namespace.php'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers PHP_CodeCoverage_Filter::addFileToBlacklist
|
||||
* @covers PHP_CodeCoverage_Filter::getBlacklist
|
||||
*/
|
||||
public function testAddingAFileToTheBlacklistWorks()
|
||||
{
|
||||
$this->filter->addFileToBlacklist($this->files[0]);
|
||||
|
||||
$this->assertEquals(
|
||||
array($this->files[0]), $this->filter->getBlacklist()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers PHP_CodeCoverage_Filter::removeFileFromBlacklist
|
||||
* @covers PHP_CodeCoverage_Filter::getBlacklist
|
||||
*/
|
||||
public function testRemovingAFileFromTheBlacklistWorks()
|
||||
{
|
||||
$this->filter->addFileToBlacklist($this->files[0]);
|
||||
$this->filter->removeFileFromBlacklist($this->files[0]);
|
||||
|
||||
$this->assertEquals(array(), $this->filter->getBlacklist());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers PHP_CodeCoverage_Filter::addDirectoryToBlacklist
|
||||
* @covers PHP_CodeCoverage_Filter::getBlacklist
|
||||
* @depends testAddingAFileToTheBlacklistWorks
|
||||
*/
|
||||
public function testAddingADirectoryToTheBlacklistWorks()
|
||||
{
|
||||
$this->filter->addDirectoryToBlacklist(TEST_FILES_PATH);
|
||||
|
||||
$blacklist = $this->filter->getBlacklist();
|
||||
sort($blacklist);
|
||||
|
||||
$this->assertEquals($this->files, $blacklist);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers PHP_CodeCoverage_Filter::addFilesToBlacklist
|
||||
* @covers PHP_CodeCoverage_Filter::getBlacklist
|
||||
*/
|
||||
public function testAddingFilesToTheBlacklistWorks()
|
||||
{
|
||||
$facade = new File_Iterator_Facade;
|
||||
$files = $facade->getFilesAsArray(
|
||||
TEST_FILES_PATH, $suffixes = '.php'
|
||||
);
|
||||
|
||||
$this->filter->addFilesToBlacklist($files);
|
||||
|
||||
$blacklist = $this->filter->getBlacklist();
|
||||
sort($blacklist);
|
||||
|
||||
$this->assertEquals($this->files, $blacklist);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers PHP_CodeCoverage_Filter::removeDirectoryFromBlacklist
|
||||
* @covers PHP_CodeCoverage_Filter::getBlacklist
|
||||
* @depends testAddingADirectoryToTheBlacklistWorks
|
||||
*/
|
||||
public function testRemovingADirectoryFromTheBlacklistWorks()
|
||||
{
|
||||
$this->filter->addDirectoryToBlacklist(TEST_FILES_PATH);
|
||||
$this->filter->removeDirectoryFromBlacklist(TEST_FILES_PATH);
|
||||
|
||||
$this->assertEquals(array(), $this->filter->getBlacklist());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers PHP_CodeCoverage_Filter::addFileToWhitelist
|
||||
* @covers PHP_CodeCoverage_Filter::getWhitelist
|
||||
*/
|
||||
public function testAddingAFileToTheWhitelistWorks()
|
||||
{
|
||||
$this->filter->addFileToWhitelist($this->files[0]);
|
||||
|
||||
$this->assertEquals(
|
||||
array($this->files[0]), $this->filter->getWhitelist()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers PHP_CodeCoverage_Filter::removeFileFromWhitelist
|
||||
* @covers PHP_CodeCoverage_Filter::getWhitelist
|
||||
*/
|
||||
public function testRemovingAFileFromTheWhitelistWorks()
|
||||
{
|
||||
$this->filter->addFileToWhitelist($this->files[0]);
|
||||
$this->filter->removeFileFromWhitelist($this->files[0]);
|
||||
|
||||
$this->assertEquals(array(), $this->filter->getWhitelist());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers PHP_CodeCoverage_Filter::addDirectoryToWhitelist
|
||||
* @covers PHP_CodeCoverage_Filter::getWhitelist
|
||||
* @depends testAddingAFileToTheWhitelistWorks
|
||||
*/
|
||||
public function testAddingADirectoryToTheWhitelistWorks()
|
||||
{
|
||||
$this->filter->addDirectoryToWhitelist(TEST_FILES_PATH);
|
||||
|
||||
$whitelist = $this->filter->getWhitelist();
|
||||
sort($whitelist);
|
||||
|
||||
$this->assertEquals($this->files, $whitelist);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers PHP_CodeCoverage_Filter::addFilesToWhitelist
|
||||
* @covers PHP_CodeCoverage_Filter::getBlacklist
|
||||
*/
|
||||
public function testAddingFilesToTheWhitelistWorks()
|
||||
{
|
||||
$facade = new File_Iterator_Facade;
|
||||
$files = $facade->getFilesAsArray(
|
||||
TEST_FILES_PATH, $suffixes = '.php'
|
||||
);
|
||||
|
||||
$this->filter->addFilesToWhitelist($files);
|
||||
|
||||
$whitelist = $this->filter->getWhitelist();
|
||||
sort($whitelist);
|
||||
|
||||
$this->assertEquals($this->files, $whitelist);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers PHP_CodeCoverage_Filter::removeDirectoryFromWhitelist
|
||||
* @covers PHP_CodeCoverage_Filter::getWhitelist
|
||||
* @depends testAddingADirectoryToTheWhitelistWorks
|
||||
*/
|
||||
public function testRemovingADirectoryFromTheWhitelistWorks()
|
||||
{
|
||||
$this->filter->addDirectoryToWhitelist(TEST_FILES_PATH);
|
||||
$this->filter->removeDirectoryFromWhitelist(TEST_FILES_PATH);
|
||||
|
||||
$this->assertEquals(array(), $this->filter->getWhitelist());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers PHP_CodeCoverage_Filter::isFile
|
||||
*/
|
||||
public function testIsFile()
|
||||
{
|
||||
$this->assertFalse($this->filter->isFile('eval()\'d code'));
|
||||
$this->assertFalse($this->filter->isFile('runtime-created function'));
|
||||
$this->assertFalse($this->filter->isFile('assert code'));
|
||||
$this->assertFalse($this->filter->isFile('regexp code'));
|
||||
$this->assertTrue($this->filter->isFile('filename'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers PHP_CodeCoverage_Filter::isFiltered
|
||||
*/
|
||||
public function testBlacklistedFileIsFiltered()
|
||||
{
|
||||
$this->filter->addFileToBlacklist($this->files[0]);
|
||||
$this->assertTrue($this->filter->isFiltered($this->files[0]));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers PHP_CodeCoverage_Filter::isFiltered
|
||||
*/
|
||||
public function testWhitelistedFileIsNotFiltered()
|
||||
{
|
||||
$this->filter->addFileToWhitelist($this->files[0]);
|
||||
$this->assertFalse($this->filter->isFiltered($this->files[0]));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers PHP_CodeCoverage_Filter::isFiltered
|
||||
*/
|
||||
public function testNotWhitelistedFileIsFiltered()
|
||||
{
|
||||
$this->filter->addFileToWhitelist($this->files[0]);
|
||||
$this->assertTrue($this->filter->isFiltered($this->files[1]));
|
||||
}
|
||||
}
|
96
includes/kohana/vendor/phpunit/php-code-coverage/Tests/PHP/CodeCoverage/Report/CloverTest.php
vendored
Normal file
96
includes/kohana/vendor/phpunit/php-code-coverage/Tests/PHP/CodeCoverage/Report/CloverTest.php
vendored
Normal file
@@ -0,0 +1,96 @@
|
||||
<?php
|
||||
/**
|
||||
* PHP_CodeCoverage
|
||||
*
|
||||
* Copyright (c) 2009-2012, Sebastian Bergmann <sb@sebastian-bergmann.de>.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* * Neither the name of Sebastian Bergmann nor the names of his
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @category PHP
|
||||
* @package CodeCoverage
|
||||
* @subpackage Tests
|
||||
* @author Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @copyright 2009-2012 Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
|
||||
* @link http://github.com/sebastianbergmann/php-code-coverage
|
||||
* @since File available since Release 1.0.0
|
||||
*/
|
||||
|
||||
if (!defined('TEST_FILES_PATH')) {
|
||||
define(
|
||||
'TEST_FILES_PATH',
|
||||
dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR .
|
||||
'_files' . DIRECTORY_SEPARATOR
|
||||
);
|
||||
}
|
||||
|
||||
require_once TEST_FILES_PATH . '../TestCase.php';
|
||||
|
||||
/**
|
||||
* Tests for the PHP_CodeCoverage_Report_Clover class.
|
||||
*
|
||||
* @category PHP
|
||||
* @package CodeCoverage
|
||||
* @subpackage Tests
|
||||
* @author Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @copyright 2009-2012 Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
|
||||
* @link http://github.com/sebastianbergmann/php-code-coverage
|
||||
* @since Class available since Release 1.0.0
|
||||
*/
|
||||
class PHP_CodeCoverage_Report_CloverTest extends PHP_CodeCoverage_TestCase
|
||||
{
|
||||
/**
|
||||
* @covers PHP_CodeCoverage_Report_Clover
|
||||
*/
|
||||
public function testCloverForBankAccountTest()
|
||||
{
|
||||
$clover = new PHP_CodeCoverage_Report_Clover;
|
||||
|
||||
$this->assertStringMatchesFormatFile(
|
||||
TEST_FILES_PATH . 'BankAccount-clover.xml',
|
||||
$clover->process($this->getCoverageForBankAccount(), NULL, 'BankAccount')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers PHP_CodeCoverage_Report_Clover
|
||||
*/
|
||||
public function testCloverForFileWithIgnoredLines()
|
||||
{
|
||||
$clover = new PHP_CodeCoverage_Report_Clover;
|
||||
|
||||
$this->assertStringMatchesFormatFile(
|
||||
TEST_FILES_PATH . 'ignored-lines-clover.xml',
|
||||
$clover->process($this->getCoverageForFileWithIgnoredLines())
|
||||
);
|
||||
}
|
||||
}
|
263
includes/kohana/vendor/phpunit/php-code-coverage/Tests/PHP/CodeCoverage/Report/FactoryTest.php
vendored
Normal file
263
includes/kohana/vendor/phpunit/php-code-coverage/Tests/PHP/CodeCoverage/Report/FactoryTest.php
vendored
Normal file
@@ -0,0 +1,263 @@
|
||||
<?php
|
||||
/**
|
||||
* PHP_CodeCoverage
|
||||
*
|
||||
* Copyright (c) 2009-2012, Sebastian Bergmann <sb@sebastian-bergmann.de>.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* * Neither the name of Sebastian Bergmann nor the names of his
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @category PHP
|
||||
* @package CodeCoverage
|
||||
* @subpackage Tests
|
||||
* @author Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @copyright 2009-2012 Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
|
||||
* @link http://github.com/sebastianbergmann/php-code-coverage
|
||||
* @since File available since Release 1.1.0
|
||||
*/
|
||||
|
||||
if (!defined('TEST_FILES_PATH')) {
|
||||
define(
|
||||
'TEST_FILES_PATH',
|
||||
dirname(dirname(dirname(dirname(__FILE__)))) . DIRECTORY_SEPARATOR .
|
||||
'_files' . DIRECTORY_SEPARATOR
|
||||
);
|
||||
}
|
||||
|
||||
require_once TEST_FILES_PATH . '../TestCase.php';
|
||||
|
||||
/**
|
||||
* Tests for the PHP_CodeCoverage_Report_Factory class.
|
||||
*
|
||||
* @category PHP
|
||||
* @package CodeCoverage
|
||||
* @subpackage Tests
|
||||
* @author Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @copyright 2009-2012 Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
|
||||
* @link http://github.com/sebastianbergmann/php-code-coverage
|
||||
* @since Class available since Release 1.1.0
|
||||
*/
|
||||
class PHP_CodeCoverage_Report_FactoryTest extends PHP_CodeCoverage_TestCase
|
||||
{
|
||||
protected $factory;
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
$this->factory = new PHP_CodeCoverage_Report_Factory;
|
||||
}
|
||||
|
||||
public function testSomething()
|
||||
{
|
||||
$root = $this->getCoverageForBankAccount()->getReport();
|
||||
|
||||
$expectedPath = rtrim(TEST_FILES_PATH, DIRECTORY_SEPARATOR);
|
||||
$this->assertEquals($expectedPath, $root->getName());
|
||||
$this->assertEquals($expectedPath, $root->getPath());
|
||||
$this->assertEquals(10, $root->getNumExecutableLines());
|
||||
$this->assertEquals(5, $root->getNumExecutedLines());
|
||||
$this->assertEquals(1, $root->getNumClasses());
|
||||
$this->assertEquals(0, $root->getNumTestedClasses());
|
||||
$this->assertEquals(4, $root->getNumMethods());
|
||||
$this->assertEquals(3, $root->getNumTestedMethods());
|
||||
$this->assertEquals('0.00%', $root->getTestedClassesPercent());
|
||||
$this->assertEquals('75.00%', $root->getTestedMethodsPercent());
|
||||
$this->assertEquals('50.00%', $root->getLineExecutedPercent());
|
||||
$this->assertEquals(0, $root->getNumFunctions());
|
||||
$this->assertEquals(0, $root->getNumTestedFunctions());
|
||||
$this->assertNull($root->getParent());
|
||||
$this->assertEquals(array(), $root->getDirectories());
|
||||
#$this->assertEquals(array(), $root->getFiles());
|
||||
#$this->assertEquals(array(), $root->getChildNodes());
|
||||
|
||||
$this->assertEquals(
|
||||
array(
|
||||
'BankAccount' => array(
|
||||
'methods' => array(
|
||||
'getBalance' => array(
|
||||
'signature' => 'getBalance()',
|
||||
'startLine' => 6,
|
||||
'endLine' => 9,
|
||||
'executableLines' => 1,
|
||||
'executedLines' => 1,
|
||||
'ccn' => 1,
|
||||
'coverage' => 100,
|
||||
'crap' => '1',
|
||||
'link' => 'BankAccount.php.html#6',
|
||||
'methodName' => 'getBalance'
|
||||
),
|
||||
'setBalance' => array(
|
||||
'signature' => 'setBalance($balance)',
|
||||
'startLine' => 11,
|
||||
'endLine' => 18,
|
||||
'executableLines' => 5,
|
||||
'executedLines' => 0,
|
||||
'ccn' => 2,
|
||||
'coverage' => 0,
|
||||
'crap' => 6,
|
||||
'link' => 'BankAccount.php.html#11',
|
||||
'methodName' => 'setBalance'
|
||||
),
|
||||
'depositMoney' => array(
|
||||
'signature' => 'depositMoney($balance)',
|
||||
'startLine' => 20,
|
||||
'endLine' => 25,
|
||||
'executableLines' => 2,
|
||||
'executedLines' => 2,
|
||||
'ccn' => 1,
|
||||
'coverage' => 100,
|
||||
'crap' => '1',
|
||||
'link' => 'BankAccount.php.html#20',
|
||||
'methodName' => 'depositMoney'
|
||||
),
|
||||
'withdrawMoney' => array(
|
||||
'signature' => 'withdrawMoney($balance)',
|
||||
'startLine' => 27,
|
||||
'endLine' => 32,
|
||||
'executableLines' => 2,
|
||||
'executedLines' => 2,
|
||||
'ccn' => 1,
|
||||
'coverage' => 100,
|
||||
'crap' => '1',
|
||||
'link' => 'BankAccount.php.html#27',
|
||||
'methodName' => 'withdrawMoney'
|
||||
),
|
||||
),
|
||||
'startLine' => 2,
|
||||
'executableLines' => 10,
|
||||
'executedLines' => 5,
|
||||
'ccn' => 5,
|
||||
'coverage' => 50,
|
||||
'crap' => '8.12',
|
||||
'package' => array(
|
||||
'namespace' => '',
|
||||
'fullPackage' => '',
|
||||
'category' => '',
|
||||
'package' => '',
|
||||
'subpackage' => ''
|
||||
),
|
||||
'link' => 'BankAccount.php.html#2',
|
||||
'className' => 'BankAccount'
|
||||
)
|
||||
),
|
||||
$root->getClasses()
|
||||
);
|
||||
|
||||
$this->assertEquals(array(), $root->getFunctions());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers PHP_CodeCoverage_Report_Factory::buildDirectoryStructure
|
||||
*/
|
||||
public function testBuildDirectoryStructure()
|
||||
{
|
||||
$method = new ReflectionMethod(
|
||||
'PHP_CodeCoverage_Report_Factory', 'buildDirectoryStructure'
|
||||
);
|
||||
|
||||
$method->setAccessible(TRUE);
|
||||
|
||||
$this->assertEquals(
|
||||
array(
|
||||
'src' => array(
|
||||
'Money.php/f' => array(),
|
||||
'MoneyBag.php/f' => array()
|
||||
)
|
||||
),
|
||||
$method->invoke(
|
||||
$this->factory,
|
||||
array('src/Money.php' => array(), 'src/MoneyBag.php' => array())
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers PHP_CodeCoverage_Report_Factory::reducePaths
|
||||
* @dataProvider reducePathsProvider
|
||||
*/
|
||||
public function testReducePaths($reducedPaths, $commonPath, $paths)
|
||||
{
|
||||
$method = new ReflectionMethod(
|
||||
'PHP_CodeCoverage_Report_Factory', 'reducePaths'
|
||||
);
|
||||
|
||||
$method->setAccessible(TRUE);
|
||||
|
||||
$_commonPath = $method->invokeArgs($this->factory, array(&$paths));
|
||||
|
||||
$this->assertEquals($reducedPaths, $paths);
|
||||
$this->assertEquals($commonPath, $_commonPath);
|
||||
}
|
||||
|
||||
public function reducePathsProvider()
|
||||
{
|
||||
return array(
|
||||
array(
|
||||
array(
|
||||
'Money.php' => array(),
|
||||
'MoneyBag.php' => array()
|
||||
),
|
||||
'/home/sb/Money',
|
||||
array(
|
||||
'/home/sb/Money/Money.php' => array(),
|
||||
'/home/sb/Money/MoneyBag.php' => array()
|
||||
)
|
||||
),
|
||||
array(
|
||||
array(
|
||||
'Money.php' => array()
|
||||
),
|
||||
'/home/sb/Money/',
|
||||
array(
|
||||
'/home/sb/Money/Money.php' => array()
|
||||
)
|
||||
),
|
||||
array(
|
||||
array(),
|
||||
'.',
|
||||
array()
|
||||
),
|
||||
array(
|
||||
array(
|
||||
'Money.php' => array(),
|
||||
'MoneyBag.php' => array(),
|
||||
'Cash.phar/Cash.php' => array(),
|
||||
),
|
||||
'/home/sb/Money',
|
||||
array(
|
||||
'/home/sb/Money/Money.php' => array(),
|
||||
'/home/sb/Money/MoneyBag.php' => array(),
|
||||
'phar:///home/sb/Money/Cash.phar/Cash.php' => array(),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
194
includes/kohana/vendor/phpunit/php-code-coverage/Tests/PHP/CodeCoverage/UtilTest.php
vendored
Normal file
194
includes/kohana/vendor/phpunit/php-code-coverage/Tests/PHP/CodeCoverage/UtilTest.php
vendored
Normal file
@@ -0,0 +1,194 @@
|
||||
<?php
|
||||
/**
|
||||
* PHP_CodeCoverage
|
||||
*
|
||||
* Copyright (c) 2009-2012, Sebastian Bergmann <sb@sebastian-bergmann.de>.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* * Neither the name of Sebastian Bergmann nor the names of his
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @category PHP
|
||||
* @package CodeCoverage
|
||||
* @subpackage Tests
|
||||
* @author Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @copyright 2009-2012 Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
|
||||
* @link http://github.com/sebastianbergmann/php-code-coverage
|
||||
* @since File available since Release 1.0.0
|
||||
*/
|
||||
|
||||
if (!defined('TEST_FILES_PATH')) {
|
||||
define(
|
||||
'TEST_FILES_PATH',
|
||||
dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR .
|
||||
'_files' . DIRECTORY_SEPARATOR
|
||||
);
|
||||
}
|
||||
|
||||
require_once TEST_FILES_PATH . 'CoverageClassExtendedTest.php';
|
||||
require_once TEST_FILES_PATH . 'CoverageClassTest.php';
|
||||
require_once TEST_FILES_PATH . 'CoverageFunctionTest.php';
|
||||
require_once TEST_FILES_PATH . 'CoverageMethodTest.php';
|
||||
require_once TEST_FILES_PATH . 'CoverageMethodOneLineAnnotationTest.php';
|
||||
require_once TEST_FILES_PATH . 'CoverageNoneTest.php';
|
||||
require_once TEST_FILES_PATH . 'CoverageNotPrivateTest.php';
|
||||
require_once TEST_FILES_PATH . 'CoverageNotProtectedTest.php';
|
||||
require_once TEST_FILES_PATH . 'CoverageNotPublicTest.php';
|
||||
require_once TEST_FILES_PATH . 'CoveragePrivateTest.php';
|
||||
require_once TEST_FILES_PATH . 'CoverageProtectedTest.php';
|
||||
require_once TEST_FILES_PATH . 'CoveragePublicTest.php';
|
||||
require_once TEST_FILES_PATH . 'CoverageTwoDefaultClassAnnotations.php';
|
||||
require_once TEST_FILES_PATH . 'CoveredClass.php';
|
||||
require_once TEST_FILES_PATH . 'CoveredFunction.php';
|
||||
require_once TEST_FILES_PATH . 'NamespaceCoverageClassExtendedTest.php';
|
||||
require_once TEST_FILES_PATH . 'NamespaceCoverageClassTest.php';
|
||||
require_once TEST_FILES_PATH . 'NamespaceCoverageCoversClassTest.php';
|
||||
require_once TEST_FILES_PATH . 'NamespaceCoverageCoversClassPublicTest.php';
|
||||
require_once TEST_FILES_PATH . 'NamespaceCoverageMethodTest.php';
|
||||
require_once TEST_FILES_PATH . 'NamespaceCoverageNotPrivateTest.php';
|
||||
require_once TEST_FILES_PATH . 'NamespaceCoverageNotProtectedTest.php';
|
||||
require_once TEST_FILES_PATH . 'NamespaceCoverageNotPublicTest.php';
|
||||
require_once TEST_FILES_PATH . 'NamespaceCoveragePrivateTest.php';
|
||||
require_once TEST_FILES_PATH . 'NamespaceCoverageProtectedTest.php';
|
||||
require_once TEST_FILES_PATH . 'NamespaceCoveragePublicTest.php';
|
||||
require_once TEST_FILES_PATH . 'NamespaceCoveredClass.php';
|
||||
require_once TEST_FILES_PATH . 'NotExistingCoveredElementTest.php';
|
||||
require_once TEST_FILES_PATH . 'CoverageNothingTest.php';
|
||||
/**
|
||||
* Tests for the PHP_CodeCoverage_Util class.
|
||||
*
|
||||
* @category PHP
|
||||
* @package CodeCoverage
|
||||
* @subpackage Tests
|
||||
* @author Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @copyright 2009-2012 Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
|
||||
* @link http://github.com/sebastianbergmann/php-code-coverage
|
||||
* @since Class available since Release 1.0.0
|
||||
*/
|
||||
class PHP_CodeCoverage_UtilTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @covers PHP_CodeCoverage_Util::getLinesToBeIgnored
|
||||
*/
|
||||
public function testGetLinesToBeIgnored()
|
||||
{
|
||||
$this->assertEquals(
|
||||
array(
|
||||
1 => TRUE,
|
||||
3 => TRUE,
|
||||
4 => TRUE,
|
||||
5 => TRUE,
|
||||
7 => TRUE,
|
||||
8 => TRUE,
|
||||
9 => TRUE,
|
||||
10 => TRUE,
|
||||
11 => TRUE,
|
||||
12 => TRUE,
|
||||
13 => TRUE,
|
||||
14 => TRUE,
|
||||
15 => TRUE,
|
||||
16 => TRUE,
|
||||
17 => TRUE,
|
||||
18 => TRUE,
|
||||
19 => TRUE,
|
||||
20 => TRUE,
|
||||
21 => TRUE,
|
||||
22 => TRUE,
|
||||
23 => TRUE,
|
||||
24 => TRUE,
|
||||
25 => TRUE,
|
||||
26 => TRUE,
|
||||
27 => TRUE,
|
||||
30 => TRUE,
|
||||
32 => TRUE,
|
||||
33 => TRUE,
|
||||
34 => TRUE,
|
||||
35 => TRUE,
|
||||
36 => TRUE,
|
||||
37 => TRUE,
|
||||
38 => TRUE,
|
||||
),
|
||||
PHP_CodeCoverage_Util::getLinesToBeIgnored(
|
||||
TEST_FILES_PATH . 'source_with_ignore.php'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers PHP_CodeCoverage_Util::getLinesToBeIgnored
|
||||
*/
|
||||
public function testGetLinesToBeIgnored2()
|
||||
{
|
||||
$this->assertEquals(
|
||||
array(1 => TRUE),
|
||||
PHP_CodeCoverage_Util::getLinesToBeIgnored(
|
||||
TEST_FILES_PATH . 'source_without_ignore.php'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers PHP_CodeCoverage_Util::getLinesToBeIgnored
|
||||
*/
|
||||
public function testGetLinesToBeIgnoredOneLineAnnotations()
|
||||
{
|
||||
$this->assertEquals(
|
||||
array(
|
||||
1 => TRUE,
|
||||
2 => TRUE,
|
||||
7 => TRUE,
|
||||
3 => TRUE,
|
||||
4 => TRUE,
|
||||
5 => TRUE,
|
||||
6 => TRUE,
|
||||
8 => TRUE,
|
||||
9 => TRUE,
|
||||
13 => TRUE,
|
||||
),
|
||||
PHP_CodeCoverage_Util::getLinesToBeIgnored(
|
||||
TEST_FILES_PATH . 'source_with_oneline_annotations.php'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @covers PHP_CodeCoverage_Util::percent
|
||||
*/
|
||||
public function testPercent()
|
||||
{
|
||||
$this->assertEquals(100, PHP_CodeCoverage_Util::percent(100, 0));
|
||||
$this->assertEquals(100, PHP_CodeCoverage_Util::percent(100, 100));
|
||||
$this->assertEquals(
|
||||
'100.00%', PHP_CodeCoverage_Util::percent(100, 100, TRUE)
|
||||
);
|
||||
}
|
||||
}
|
499
includes/kohana/vendor/phpunit/php-code-coverage/Tests/PHP/CodeCoverageTest.php
vendored
Normal file
499
includes/kohana/vendor/phpunit/php-code-coverage/Tests/PHP/CodeCoverageTest.php
vendored
Normal file
@@ -0,0 +1,499 @@
|
||||
<?php
|
||||
/**
|
||||
* PHP_CodeCoverage
|
||||
*
|
||||
* Copyright (c) 2009-2012, Sebastian Bergmann <sb@sebastian-bergmann.de>.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* * Neither the name of Sebastian Bergmann nor the names of his
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @category PHP
|
||||
* @package CodeCoverage
|
||||
* @subpackage Tests
|
||||
* @author Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @copyright 2009-2012 Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
|
||||
* @link http://github.com/sebastianbergmann/php-code-coverage
|
||||
* @since File available since Release 1.0.0
|
||||
*/
|
||||
|
||||
if (!defined('TEST_FILES_PATH')) {
|
||||
define(
|
||||
'TEST_FILES_PATH',
|
||||
dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR .
|
||||
'_files' . DIRECTORY_SEPARATOR
|
||||
);
|
||||
}
|
||||
|
||||
require_once TEST_FILES_PATH . '../TestCase.php';
|
||||
|
||||
require_once TEST_FILES_PATH . 'BankAccount.php';
|
||||
require_once TEST_FILES_PATH . 'BankAccountTest.php';
|
||||
|
||||
/**
|
||||
* Tests for the PHP_CodeCoverage class.
|
||||
*
|
||||
* @category PHP
|
||||
* @package CodeCoverage
|
||||
* @subpackage Tests
|
||||
* @author Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @copyright 2009-2012 Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
|
||||
* @link http://github.com/sebastianbergmann/php-code-coverage
|
||||
* @since Class available since Release 1.0.0
|
||||
*/
|
||||
class PHP_CodeCoverageTest extends PHP_CodeCoverage_TestCase
|
||||
{
|
||||
protected $coverage;
|
||||
protected $getLinesToBeCovered;
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
$this->coverage = new PHP_CodeCoverage;
|
||||
|
||||
$this->getLinesToBeCovered = new ReflectionMethod(
|
||||
'PHP_CodeCoverage', 'getLinesToBeCovered'
|
||||
);
|
||||
|
||||
$this->getLinesToBeCovered->setAccessible(TRUE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers PHP_CodeCoverage::__construct
|
||||
* @covers PHP_CodeCoverage::filter
|
||||
*/
|
||||
public function testConstructor()
|
||||
{
|
||||
$this->assertAttributeInstanceOf(
|
||||
'PHP_CodeCoverage_Driver_Xdebug', 'driver', $this->coverage
|
||||
);
|
||||
|
||||
$this->assertAttributeInstanceOf(
|
||||
'PHP_CodeCoverage_Filter', 'filter', $this->coverage
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers PHP_CodeCoverage::__construct
|
||||
* @covers PHP_CodeCoverage::filter
|
||||
*/
|
||||
public function testConstructor2()
|
||||
{
|
||||
$filter = new PHP_CodeCoverage_Filter;
|
||||
$coverage = new PHP_CodeCoverage(NULL, $filter);
|
||||
|
||||
$this->assertAttributeInstanceOf(
|
||||
'PHP_CodeCoverage_Driver_Xdebug', 'driver', $coverage
|
||||
);
|
||||
|
||||
$this->assertSame($filter, $coverage->filter());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers PHP_CodeCoverage::start
|
||||
* @expectedException PHP_CodeCoverage_Exception
|
||||
*/
|
||||
public function testStartThrowsExceptionForInvalidArgument()
|
||||
{
|
||||
$this->coverage->start(NULL, array(), NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers PHP_CodeCoverage::stop
|
||||
* @expectedException PHP_CodeCoverage_Exception
|
||||
*/
|
||||
public function testStopThrowsExceptionForInvalidArgument()
|
||||
{
|
||||
$this->coverage->stop(NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers PHP_CodeCoverage::append
|
||||
* @expectedException PHP_CodeCoverage_Exception
|
||||
*/
|
||||
public function testAppendThrowsExceptionForInvalidArgument()
|
||||
{
|
||||
$this->coverage->append(array(), NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers PHP_CodeCoverage::setCacheTokens
|
||||
* @expectedException PHP_CodeCoverage_Exception
|
||||
*/
|
||||
public function testSetCacheTokensThrowsExceptionForInvalidArgument()
|
||||
{
|
||||
$this->coverage->setCacheTokens(NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers PHP_CodeCoverage::setCacheTokens
|
||||
*/
|
||||
public function testSetCacheTokens()
|
||||
{
|
||||
$this->coverage->setCacheTokens(TRUE);
|
||||
$this->assertAttributeEquals(TRUE, 'cacheTokens', $this->coverage);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers PHP_CodeCoverage::setForceCoversAnnotation
|
||||
* @expectedException PHP_CodeCoverage_Exception
|
||||
*/
|
||||
public function testSetForceCoversAnnotationThrowsExceptionForInvalidArgument()
|
||||
{
|
||||
$this->coverage->setForceCoversAnnotation(NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers PHP_CodeCoverage::setForceCoversAnnotation
|
||||
*/
|
||||
public function testSetForceCoversAnnotation()
|
||||
{
|
||||
$this->coverage->setForceCoversAnnotation(TRUE);
|
||||
$this->assertAttributeEquals(
|
||||
TRUE, 'forceCoversAnnotation', $this->coverage
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers PHP_CodeCoverage::setProcessUncoveredFilesFromWhitelist
|
||||
* @expectedException PHP_CodeCoverage_Exception
|
||||
*/
|
||||
public function testSetProcessUncoveredFilesFromWhitelistThrowsExceptionForInvalidArgument()
|
||||
{
|
||||
$this->coverage->setProcessUncoveredFilesFromWhitelist(NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers PHP_CodeCoverage::setProcessUncoveredFilesFromWhitelist
|
||||
*/
|
||||
public function testSetProcessUncoveredFilesFromWhitelist()
|
||||
{
|
||||
$this->coverage->setProcessUncoveredFilesFromWhitelist(TRUE);
|
||||
$this->assertAttributeEquals(
|
||||
TRUE, 'processUncoveredFilesFromWhitelist', $this->coverage
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers PHP_CodeCoverage::setMapTestClassNameToCoveredClassName
|
||||
*/
|
||||
public function testSetMapTestClassNameToCoveredClassName()
|
||||
{
|
||||
$this->coverage->setMapTestClassNameToCoveredClassName(TRUE);
|
||||
$this->assertAttributeEquals(
|
||||
TRUE, 'mapTestClassNameToCoveredClassName', $this->coverage
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers PHP_CodeCoverage::setMapTestClassNameToCoveredClassName
|
||||
* @expectedException PHP_CodeCoverage_Exception
|
||||
*/
|
||||
public function testSetMapTestClassNameToCoveredClassNameThrowsExceptionForInvalidArgument()
|
||||
{
|
||||
$this->coverage->setMapTestClassNameToCoveredClassName(NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers PHP_CodeCoverage::clear
|
||||
*/
|
||||
public function testClear()
|
||||
{
|
||||
$this->coverage->clear();
|
||||
|
||||
$this->assertAttributeEquals(NULL, 'currentId', $this->coverage);
|
||||
$this->assertAttributeEquals(array(), 'data', $this->coverage);
|
||||
$this->assertAttributeEquals(array(), 'tests', $this->coverage);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add parenthesis to the covers annotation below in a couple of different ways to make sure it
|
||||
* works as expected
|
||||
*
|
||||
* @covers PHP_CodeCoverage::start()
|
||||
* @covers PHP_CodeCoverage::stop( )
|
||||
* @covers PHP_CodeCoverage::append ()
|
||||
* @covers PHP_CodeCoverage::applyListsFilter ( )
|
||||
* @covers PHP_CodeCoverage::initializeFilesThatAreSeenTheFirstTime
|
||||
* @covers PHP_CodeCoverage::applyCoversAnnotationFilter
|
||||
* @covers PHP_CodeCoverage::getTests
|
||||
*/
|
||||
public function testCollect()
|
||||
{
|
||||
$coverage = $this->getCoverageForBankAccount();
|
||||
|
||||
$this->assertEquals(
|
||||
$this->getExpectedDataArrayForBankAccount(), $coverage->getData()
|
||||
);
|
||||
|
||||
$this->assertEquals(
|
||||
array(
|
||||
'BankAccountTest::testBalanceIsInitiallyZero' => NULL,
|
||||
'BankAccountTest::testBalanceCannotBecomeNegative' => NULL,
|
||||
'BankAccountTest::testBalanceCannotBecomeNegative2' => NULL,
|
||||
'BankAccountTest::testDepositWithdrawMoney' => NULL
|
||||
),
|
||||
$coverage->getTests()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers PHP_CodeCoverage::getData
|
||||
* @covers PHP_CodeCoverage::merge
|
||||
*/
|
||||
public function testMerge()
|
||||
{
|
||||
$coverage = $this->getCoverageForBankAccountForFirstTwoTests();
|
||||
$coverage->merge($this->getCoverageForBankAccountForLastTwoTests());
|
||||
|
||||
$this->assertEquals(
|
||||
$this->getExpectedDataArrayForBankAccount(), $coverage->getData()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers PHP_CodeCoverage::getData
|
||||
* @covers PHP_CodeCoverage::merge
|
||||
*/
|
||||
public function testMerge2()
|
||||
{
|
||||
$coverage = new PHP_CodeCoverage(
|
||||
$this->getMock('PHP_CodeCoverage_Driver_Xdebug'),
|
||||
new PHP_CodeCoverage_Filter
|
||||
);
|
||||
|
||||
$coverage->merge($this->getCoverageForBankAccount());
|
||||
|
||||
$this->assertEquals(
|
||||
$this->getExpectedDataArrayForBankAccount(), $coverage->getData()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers PHP_CodeCoverage::getLinesToBeCovered
|
||||
* @covers PHP_CodeCoverage::resolveCoversToReflectionObjects
|
||||
* @dataProvider getLinesToBeCoveredProvider
|
||||
*/
|
||||
public function testGetLinesToBeCovered($test, $lines)
|
||||
{
|
||||
if (strpos($test, 'Namespace') === 0) {
|
||||
$expected = array(
|
||||
TEST_FILES_PATH . 'NamespaceCoveredClass.php' => $lines
|
||||
);
|
||||
}
|
||||
|
||||
else if ($test === 'CoverageNoneTest' || $test === 'CoverageNothingTest') {
|
||||
$expected = array();
|
||||
}
|
||||
|
||||
else if ($test === 'CoverageFunctionTest') {
|
||||
$expected = array(
|
||||
TEST_FILES_PATH . 'CoveredFunction.php' => $lines
|
||||
);
|
||||
}
|
||||
|
||||
else {
|
||||
$expected = array(TEST_FILES_PATH . 'CoveredClass.php' => $lines);
|
||||
}
|
||||
|
||||
$this->assertEquals(
|
||||
$expected,
|
||||
$this->getLinesToBeCovered->invoke(
|
||||
$this->coverage, $test, 'testSomething'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers PHP_CodeCoverage::getLinesToBeCovered
|
||||
* @covers PHP_CodeCoverage::resolveCoversToReflectionObjects
|
||||
* @expectedException PHP_CodeCoverage_Exception
|
||||
*/
|
||||
public function testGetLinesToBeCovered2()
|
||||
{
|
||||
$this->getLinesToBeCovered->invoke(
|
||||
$this->coverage, 'NotExistingCoveredElementTest', 'testOne'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers PHP_CodeCoverage::getLinesToBeCovered
|
||||
* @covers PHP_CodeCoverage::resolveCoversToReflectionObjects
|
||||
* @expectedException PHP_CodeCoverage_Exception
|
||||
*/
|
||||
public function testGetLinesToBeCovered3()
|
||||
{
|
||||
$this->getLinesToBeCovered->invoke(
|
||||
$this->coverage, 'NotExistingCoveredElementTest', 'testTwo'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers PHP_CodeCoverage::getLinesToBeCovered
|
||||
* @covers PHP_CodeCoverage::resolveCoversToReflectionObjects
|
||||
* @expectedException PHP_CodeCoverage_Exception
|
||||
*/
|
||||
public function testGetLinesToBeCovered4()
|
||||
{
|
||||
$this->getLinesToBeCovered->invoke(
|
||||
$this->coverage, 'NotExistingCoveredElementTest', 'testThree'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers PHP_CodeCoverage::getLinesToBeCovered
|
||||
*/
|
||||
public function testGetLinesToBeCoveredSkipsNonExistantMethods()
|
||||
{
|
||||
$this->assertSame(
|
||||
array(),
|
||||
$this->getLinesToBeCovered->invoke(
|
||||
$this->coverage,
|
||||
'NotExistingCoveredElementTest',
|
||||
'methodDoesNotExist'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers PHP_CodeCoverage::getLinesToBeCovered
|
||||
* @expectedException PHP_CodeCoverage_Exception
|
||||
*/
|
||||
public function testTwoCoversDefaultClassAnnoationsAreNotAllowed()
|
||||
{
|
||||
$this->getLinesToBeCovered->invoke(
|
||||
$this->coverage,
|
||||
'CoverageTwoDefaultClassAnnotations',
|
||||
'testSomething'
|
||||
);
|
||||
}
|
||||
|
||||
public function getLinesToBeCoveredProvider()
|
||||
{
|
||||
return array(
|
||||
array(
|
||||
'CoverageNoneTest',
|
||||
array()
|
||||
),
|
||||
array(
|
||||
'CoverageClassExtendedTest',
|
||||
array_merge(range(19, 36), range(2, 17))
|
||||
),
|
||||
array(
|
||||
'CoverageClassTest',
|
||||
range(19, 36)
|
||||
),
|
||||
array(
|
||||
'CoverageMethodTest',
|
||||
range(31, 35)
|
||||
),
|
||||
array(
|
||||
'CoverageMethodOneLineAnnotationTest',
|
||||
range(31, 35)
|
||||
),
|
||||
array(
|
||||
'CoverageNotPrivateTest',
|
||||
array_merge(range(25, 29), range(31, 35))
|
||||
),
|
||||
array(
|
||||
'CoverageNotProtectedTest',
|
||||
array_merge(range(21, 23), range(31, 35))
|
||||
),
|
||||
array(
|
||||
'CoverageNotPublicTest',
|
||||
array_merge(range(21, 23), range(25, 29))
|
||||
),
|
||||
array(
|
||||
'CoveragePrivateTest',
|
||||
range(21, 23)
|
||||
),
|
||||
array(
|
||||
'CoverageProtectedTest',
|
||||
range(25, 29)
|
||||
),
|
||||
array(
|
||||
'CoveragePublicTest',
|
||||
range(31, 35)
|
||||
),
|
||||
array(
|
||||
'CoverageFunctionTest',
|
||||
range(2, 4)
|
||||
),
|
||||
array(
|
||||
'NamespaceCoverageClassExtendedTest',
|
||||
array_merge(range(21, 38), range(4, 19))
|
||||
),
|
||||
array(
|
||||
'NamespaceCoverageClassTest',
|
||||
range(21, 38)
|
||||
),
|
||||
array(
|
||||
'NamespaceCoverageMethodTest',
|
||||
range(33, 37)
|
||||
),
|
||||
array(
|
||||
'NamespaceCoverageNotPrivateTest',
|
||||
array_merge(range(27, 31), range(33, 37))
|
||||
),
|
||||
array(
|
||||
'NamespaceCoverageNotProtectedTest',
|
||||
array_merge(range(23, 25), range(33, 37))
|
||||
),
|
||||
array(
|
||||
'NamespaceCoverageNotPublicTest',
|
||||
array_merge(range(23, 25), range(27, 31))
|
||||
),
|
||||
array(
|
||||
'NamespaceCoveragePrivateTest',
|
||||
range(23, 25)
|
||||
),
|
||||
array(
|
||||
'NamespaceCoverageProtectedTest',
|
||||
range(27, 31)
|
||||
),
|
||||
array(
|
||||
'NamespaceCoveragePublicTest',
|
||||
range(33, 37)
|
||||
),
|
||||
array(
|
||||
'NamespaceCoverageCoversClassTest',
|
||||
array_merge(range(23, 25), range(27, 31), range(33, 37), range(6, 8), range(10, 13), range(15, 18))
|
||||
),
|
||||
array(
|
||||
'NamespaceCoverageCoversClassPublicTest',
|
||||
range(33, 37)
|
||||
),
|
||||
array(
|
||||
'CoverageNothingTest',
|
||||
array()
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
266
includes/kohana/vendor/phpunit/php-code-coverage/Tests/TestCase.php
vendored
Normal file
266
includes/kohana/vendor/phpunit/php-code-coverage/Tests/TestCase.php
vendored
Normal file
@@ -0,0 +1,266 @@
|
||||
<?php
|
||||
/**
|
||||
* PHP_CodeCoverage
|
||||
*
|
||||
* Copyright (c) 2009-2012, Sebastian Bergmann <sb@sebastian-bergmann.de>.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* * Neither the name of Sebastian Bergmann nor the names of his
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @category PHP
|
||||
* @package CodeCoverage
|
||||
* @subpackage Tests
|
||||
* @author Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @copyright 2009-2012 Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
|
||||
* @link http://github.com/sebastianbergmann/php-code-coverage
|
||||
* @since File available since Release 1.0.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Abstract base class for test case classes.
|
||||
*
|
||||
* @category PHP
|
||||
* @package CodeCoverage
|
||||
* @subpackage Tests
|
||||
* @author Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @copyright 2009-2012 Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
|
||||
* @link http://github.com/sebastianbergmann/php-code-coverage
|
||||
* @since Class available since Release 1.0.0
|
||||
*/
|
||||
abstract class PHP_CodeCoverage_TestCase extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected function getXdebugDataForBankAccount()
|
||||
{
|
||||
return array(
|
||||
array(
|
||||
TEST_FILES_PATH . 'BankAccount.php' => array(
|
||||
8 => 1,
|
||||
9 => -2,
|
||||
13 => -1,
|
||||
14 => -1,
|
||||
15 => -1,
|
||||
16 => -1,
|
||||
18 => -1,
|
||||
22 => -1,
|
||||
24 => -1,
|
||||
25 => -2,
|
||||
29 => -1,
|
||||
31 => -1,
|
||||
32 => -2
|
||||
)
|
||||
),
|
||||
array(
|
||||
TEST_FILES_PATH . 'BankAccount.php' => array(
|
||||
8 => 1,
|
||||
13 => 1,
|
||||
16 => 1,
|
||||
29 => 1,
|
||||
)
|
||||
),
|
||||
array(
|
||||
TEST_FILES_PATH . 'BankAccount.php' => array(
|
||||
8 => 1,
|
||||
13 => 1,
|
||||
16 => 1,
|
||||
22 => 1,
|
||||
)
|
||||
),
|
||||
array(
|
||||
TEST_FILES_PATH . 'BankAccount.php' => array(
|
||||
8 => 1,
|
||||
13 => 1,
|
||||
14 => 1,
|
||||
15 => 1,
|
||||
18 => 1,
|
||||
22 => 1,
|
||||
24 => 1,
|
||||
29 => 1,
|
||||
31 => 1,
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
protected function getCoverageForBankAccount()
|
||||
{
|
||||
$data = $this->getXdebugDataForBankAccount();
|
||||
|
||||
$stub = $this->getMock('PHP_CodeCoverage_Driver_Xdebug');
|
||||
$stub->expects($this->any())
|
||||
->method('stop')
|
||||
->will($this->onConsecutiveCalls(
|
||||
$data[0], $data[1], $data[2], $data[3]
|
||||
));
|
||||
|
||||
$coverage = new PHP_CodeCoverage($stub, new PHP_CodeCoverage_Filter);
|
||||
|
||||
$coverage->start(
|
||||
new BankAccountTest('testBalanceIsInitiallyZero'), TRUE
|
||||
);
|
||||
$coverage->stop();
|
||||
|
||||
$coverage->start(
|
||||
new BankAccountTest('testBalanceCannotBecomeNegative')
|
||||
);
|
||||
$coverage->stop();
|
||||
|
||||
$coverage->start(
|
||||
new BankAccountTest('testBalanceCannotBecomeNegative2')
|
||||
);
|
||||
$coverage->stop();
|
||||
|
||||
$coverage->start(
|
||||
new BankAccountTest('testDepositWithdrawMoney')
|
||||
);
|
||||
$coverage->stop();
|
||||
|
||||
return $coverage;
|
||||
}
|
||||
|
||||
protected function getCoverageForBankAccountForFirstTwoTests()
|
||||
{
|
||||
$data = $this->getXdebugDataForBankAccount();
|
||||
|
||||
$stub = $this->getMock('PHP_CodeCoverage_Driver_Xdebug');
|
||||
$stub->expects($this->any())
|
||||
->method('stop')
|
||||
->will($this->onConsecutiveCalls(
|
||||
$data[0], $data[1]
|
||||
));
|
||||
|
||||
$coverage = new PHP_CodeCoverage($stub, new PHP_CodeCoverage_Filter);
|
||||
|
||||
$coverage->start(
|
||||
new BankAccountTest('testBalanceIsInitiallyZero'), TRUE
|
||||
);
|
||||
$coverage->stop();
|
||||
|
||||
$coverage->start(
|
||||
new BankAccountTest('testBalanceCannotBecomeNegative')
|
||||
);
|
||||
$coverage->stop();
|
||||
|
||||
return $coverage;
|
||||
}
|
||||
|
||||
protected function getCoverageForBankAccountForLastTwoTests()
|
||||
{
|
||||
$data = $this->getXdebugDataForBankAccount();
|
||||
|
||||
$stub = $this->getMock('PHP_CodeCoverage_Driver_Xdebug');
|
||||
$stub->expects($this->any())
|
||||
->method('stop')
|
||||
->will($this->onConsecutiveCalls(
|
||||
$data[2], $data[3]
|
||||
));
|
||||
|
||||
$coverage = new PHP_CodeCoverage($stub, new PHP_CodeCoverage_Filter);
|
||||
|
||||
$coverage->start(
|
||||
new BankAccountTest('testBalanceCannotBecomeNegative2'), TRUE
|
||||
);
|
||||
$coverage->stop();
|
||||
|
||||
$coverage->start(
|
||||
new BankAccountTest('testDepositWithdrawMoney')
|
||||
);
|
||||
$coverage->stop();
|
||||
|
||||
return $coverage;
|
||||
}
|
||||
|
||||
protected function getExpectedDataArrayForBankAccount()
|
||||
{
|
||||
return array(
|
||||
TEST_FILES_PATH . 'BankAccount.php' => array(
|
||||
8 => array(
|
||||
0 => 'BankAccountTest::testBalanceIsInitiallyZero',
|
||||
1 => 'BankAccountTest::testDepositWithdrawMoney'
|
||||
),
|
||||
9 => NULL,
|
||||
13 => array(),
|
||||
14 => array(),
|
||||
15 => array(),
|
||||
16 => array(),
|
||||
18 => array(),
|
||||
22 => array(
|
||||
0 => 'BankAccountTest::testBalanceCannotBecomeNegative2',
|
||||
1 => 'BankAccountTest::testDepositWithdrawMoney'
|
||||
),
|
||||
24 => array(
|
||||
0 => 'BankAccountTest::testDepositWithdrawMoney',
|
||||
),
|
||||
25 => NULL,
|
||||
29 => array(
|
||||
0 => 'BankAccountTest::testBalanceCannotBecomeNegative',
|
||||
1 => 'BankAccountTest::testDepositWithdrawMoney'
|
||||
),
|
||||
31 => array(
|
||||
0 => 'BankAccountTest::testDepositWithdrawMoney'
|
||||
),
|
||||
32 => NULL
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
protected function getCoverageForFileWithIgnoredLines()
|
||||
{
|
||||
$coverage = new PHP_CodeCoverage(
|
||||
$this->setUpXdebugStubForFileWithIgnoredLines(),
|
||||
new PHP_CodeCoverage_Filter
|
||||
);
|
||||
|
||||
$coverage->start('FileWithIgnoredLines', TRUE);
|
||||
$coverage->stop();
|
||||
|
||||
return $coverage;
|
||||
}
|
||||
|
||||
protected function setUpXdebugStubForFileWithIgnoredLines()
|
||||
{
|
||||
$stub = $this->getMock('PHP_CodeCoverage_Driver_Xdebug');
|
||||
$stub->expects($this->any())
|
||||
->method('stop')
|
||||
->will($this->returnValue(
|
||||
array(
|
||||
TEST_FILES_PATH . 'source_with_ignore.php' => array(
|
||||
2 => 1,
|
||||
4 => -1,
|
||||
6 => -1,
|
||||
7 => 1
|
||||
)
|
||||
)
|
||||
));
|
||||
|
||||
return $stub;
|
||||
}
|
||||
}
|
26
includes/kohana/vendor/phpunit/php-code-coverage/Tests/_files/BankAccount-clover.xml
vendored
Normal file
26
includes/kohana/vendor/phpunit/php-code-coverage/Tests/_files/BankAccount-clover.xml
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<coverage generated="%i">
|
||||
<project timestamp="%i" name="BankAccount">
|
||||
<file name="%s/BankAccount.php">
|
||||
<class name="BankAccount" namespace="global">
|
||||
<metrics methods="4" coveredmethods="3" conditionals="0" coveredconditionals="0" statements="10" coveredstatements="5" elements="14" coveredelements="8"/>
|
||||
</class>
|
||||
<line num="6" type="method" name="getBalance" crap="1" count="2"/>
|
||||
<line num="8" type="stmt" count="2"/>
|
||||
<line num="11" type="method" name="setBalance" crap="6" count="0"/>
|
||||
<line num="13" type="stmt" count="0"/>
|
||||
<line num="14" type="stmt" count="0"/>
|
||||
<line num="15" type="stmt" count="0"/>
|
||||
<line num="16" type="stmt" count="0"/>
|
||||
<line num="18" type="stmt" count="0"/>
|
||||
<line num="20" type="method" name="depositMoney" crap="1" count="2"/>
|
||||
<line num="22" type="stmt" count="2"/>
|
||||
<line num="24" type="stmt" count="1"/>
|
||||
<line num="27" type="method" name="withdrawMoney" crap="1" count="2"/>
|
||||
<line num="29" type="stmt" count="2"/>
|
||||
<line num="31" type="stmt" count="1"/>
|
||||
<metrics loc="33" ncloc="33" classes="1" methods="4" coveredmethods="3" conditionals="0" coveredconditionals="0" statements="10" coveredstatements="5" elements="14" coveredelements="8"/>
|
||||
</file>
|
||||
<metrics files="1" loc="33" ncloc="33" classes="1" methods="4" coveredmethods="3" conditionals="0" coveredconditionals="0" statements="10" coveredstatements="5" elements="14" coveredelements="8"/>
|
||||
</project>
|
||||
</coverage>
|
33
includes/kohana/vendor/phpunit/php-code-coverage/Tests/_files/BankAccount.php
vendored
Normal file
33
includes/kohana/vendor/phpunit/php-code-coverage/Tests/_files/BankAccount.php
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
class BankAccount
|
||||
{
|
||||
protected $balance = 0;
|
||||
|
||||
public function getBalance()
|
||||
{
|
||||
return $this->balance;
|
||||
}
|
||||
|
||||
protected function setBalance($balance)
|
||||
{
|
||||
if ($balance >= 0) {
|
||||
$this->balance = $balance;
|
||||
} else {
|
||||
throw new RuntimeException;
|
||||
}
|
||||
}
|
||||
|
||||
public function depositMoney($balance)
|
||||
{
|
||||
$this->setBalance($this->getBalance() + $balance);
|
||||
|
||||
return $this->getBalance();
|
||||
}
|
||||
|
||||
public function withdrawMoney($balance)
|
||||
{
|
||||
$this->setBalance($this->getBalance() - $balance);
|
||||
|
||||
return $this->getBalance();
|
||||
}
|
||||
}
|
70
includes/kohana/vendor/phpunit/php-code-coverage/Tests/_files/BankAccountTest.php
vendored
Normal file
70
includes/kohana/vendor/phpunit/php-code-coverage/Tests/_files/BankAccountTest.php
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
require_once 'BankAccount.php';
|
||||
|
||||
class BankAccountTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected $ba;
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
$this->ba = new BankAccount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers BankAccount::getBalance
|
||||
*/
|
||||
public function testBalanceIsInitiallyZero()
|
||||
{
|
||||
$this->assertEquals(0, $this->ba->getBalance());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers BankAccount::withdrawMoney
|
||||
*/
|
||||
public function testBalanceCannotBecomeNegative()
|
||||
{
|
||||
try {
|
||||
$this->ba->withdrawMoney(1);
|
||||
}
|
||||
|
||||
catch (RuntimeException $e) {
|
||||
$this->assertEquals(0, $this->ba->getBalance());
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$this->fail();
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers BankAccount::depositMoney
|
||||
*/
|
||||
public function testBalanceCannotBecomeNegative2()
|
||||
{
|
||||
try {
|
||||
$this->ba->depositMoney(-1);
|
||||
}
|
||||
|
||||
catch (RuntimeException $e) {
|
||||
$this->assertEquals(0, $this->ba->getBalance());
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$this->fail();
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers BankAccount::getBalance
|
||||
* @covers BankAccount::depositMoney
|
||||
* @covers BankAccount::withdrawMoney
|
||||
*/
|
||||
public function testDepositWithdrawMoney()
|
||||
{
|
||||
$this->assertEquals(0, $this->ba->getBalance());
|
||||
$this->ba->depositMoney(1);
|
||||
$this->assertEquals(1, $this->ba->getBalance());
|
||||
$this->ba->withdrawMoney(1);
|
||||
$this->assertEquals(0, $this->ba->getBalance());
|
||||
}
|
||||
}
|
12
includes/kohana/vendor/phpunit/php-code-coverage/Tests/_files/CoverageClassExtendedTest.php
vendored
Normal file
12
includes/kohana/vendor/phpunit/php-code-coverage/Tests/_files/CoverageClassExtendedTest.php
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
class CoverageClassExtendedTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @covers CoveredClass<extended>
|
||||
*/
|
||||
public function testSomething()
|
||||
{
|
||||
$o = new CoveredClass;
|
||||
$o->publicMethod();
|
||||
}
|
||||
}
|
12
includes/kohana/vendor/phpunit/php-code-coverage/Tests/_files/CoverageClassTest.php
vendored
Normal file
12
includes/kohana/vendor/phpunit/php-code-coverage/Tests/_files/CoverageClassTest.php
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
class CoverageClassTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @covers CoveredClass
|
||||
*/
|
||||
public function testSomething()
|
||||
{
|
||||
$o = new CoveredClass;
|
||||
$o->publicMethod();
|
||||
}
|
||||
}
|
11
includes/kohana/vendor/phpunit/php-code-coverage/Tests/_files/CoverageFunctionTest.php
vendored
Normal file
11
includes/kohana/vendor/phpunit/php-code-coverage/Tests/_files/CoverageFunctionTest.php
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
class CoverageFunctionTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @covers ::globalFunction
|
||||
*/
|
||||
public function testSomething()
|
||||
{
|
||||
globalFunction();
|
||||
}
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
class CoverageMethodOneLineAnnotationTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
/** @covers CoveredClass::publicMethod */
|
||||
public function testSomething()
|
||||
{
|
||||
$o = new CoveredClass;
|
||||
$o->publicMethod();
|
||||
}
|
||||
}
|
||||
|
12
includes/kohana/vendor/phpunit/php-code-coverage/Tests/_files/CoverageMethodTest.php
vendored
Normal file
12
includes/kohana/vendor/phpunit/php-code-coverage/Tests/_files/CoverageMethodTest.php
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
class CoverageMethodTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @covers CoveredClass::publicMethod
|
||||
*/
|
||||
public function testSomething()
|
||||
{
|
||||
$o = new CoveredClass;
|
||||
$o->publicMethod();
|
||||
}
|
||||
}
|
9
includes/kohana/vendor/phpunit/php-code-coverage/Tests/_files/CoverageNoneTest.php
vendored
Normal file
9
includes/kohana/vendor/phpunit/php-code-coverage/Tests/_files/CoverageNoneTest.php
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
class CoverageNoneTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testSomething()
|
||||
{
|
||||
$o = new CoveredClass;
|
||||
$o->publicMethod();
|
||||
}
|
||||
}
|
12
includes/kohana/vendor/phpunit/php-code-coverage/Tests/_files/CoverageNotPrivateTest.php
vendored
Normal file
12
includes/kohana/vendor/phpunit/php-code-coverage/Tests/_files/CoverageNotPrivateTest.php
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
class CoverageNotPrivateTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @covers CoveredClass::<!private>
|
||||
*/
|
||||
public function testSomething()
|
||||
{
|
||||
$o = new CoveredClass;
|
||||
$o->publicMethod();
|
||||
}
|
||||
}
|
12
includes/kohana/vendor/phpunit/php-code-coverage/Tests/_files/CoverageNotProtectedTest.php
vendored
Normal file
12
includes/kohana/vendor/phpunit/php-code-coverage/Tests/_files/CoverageNotProtectedTest.php
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
class CoverageNotProtectedTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @covers CoveredClass::<!protected>
|
||||
*/
|
||||
public function testSomething()
|
||||
{
|
||||
$o = new CoveredClass;
|
||||
$o->publicMethod();
|
||||
}
|
||||
}
|
12
includes/kohana/vendor/phpunit/php-code-coverage/Tests/_files/CoverageNotPublicTest.php
vendored
Normal file
12
includes/kohana/vendor/phpunit/php-code-coverage/Tests/_files/CoverageNotPublicTest.php
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
class CoverageNotPublicTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @covers CoveredClass::<!public>
|
||||
*/
|
||||
public function testSomething()
|
||||
{
|
||||
$o = new CoveredClass;
|
||||
$o->publicMethod();
|
||||
}
|
||||
}
|
13
includes/kohana/vendor/phpunit/php-code-coverage/Tests/_files/CoverageNothingTest.php
vendored
Normal file
13
includes/kohana/vendor/phpunit/php-code-coverage/Tests/_files/CoverageNothingTest.php
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
class CoverageNothingTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @covers CoveredClass::publicMethod
|
||||
* @coversNothing
|
||||
*/
|
||||
public function testSomething()
|
||||
{
|
||||
$o = new CoveredClass;
|
||||
$o->publicMethod();
|
||||
}
|
||||
}
|
12
includes/kohana/vendor/phpunit/php-code-coverage/Tests/_files/CoveragePrivateTest.php
vendored
Normal file
12
includes/kohana/vendor/phpunit/php-code-coverage/Tests/_files/CoveragePrivateTest.php
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
class CoveragePrivateTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @covers CoveredClass::<private>
|
||||
*/
|
||||
public function testSomething()
|
||||
{
|
||||
$o = new CoveredClass;
|
||||
$o->publicMethod();
|
||||
}
|
||||
}
|
12
includes/kohana/vendor/phpunit/php-code-coverage/Tests/_files/CoverageProtectedTest.php
vendored
Normal file
12
includes/kohana/vendor/phpunit/php-code-coverage/Tests/_files/CoverageProtectedTest.php
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
class CoverageProtectedTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @covers CoveredClass::<protected>
|
||||
*/
|
||||
public function testSomething()
|
||||
{
|
||||
$o = new CoveredClass;
|
||||
$o->publicMethod();
|
||||
}
|
||||
}
|
12
includes/kohana/vendor/phpunit/php-code-coverage/Tests/_files/CoveragePublicTest.php
vendored
Normal file
12
includes/kohana/vendor/phpunit/php-code-coverage/Tests/_files/CoveragePublicTest.php
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
class CoveragePublicTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @covers CoveredClass::<public>
|
||||
*/
|
||||
public function testSomething()
|
||||
{
|
||||
$o = new CoveredClass;
|
||||
$o->publicMethod();
|
||||
}
|
||||
}
|
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @coversDefaultClass \NamespaceOne
|
||||
* @coversDefaultClass \AnotherDefault\Name\Space\Does\Not\Work
|
||||
*/
|
||||
class CoverageTwoDefaultClassAnnotations
|
||||
{
|
||||
|
||||
/**
|
||||
* @covers Foo\CoveredClass::<public>
|
||||
*/
|
||||
public function testSomething()
|
||||
{
|
||||
$o = new Foo\CoveredClass;
|
||||
$o->publicMethod();
|
||||
}
|
||||
|
||||
}
|
36
includes/kohana/vendor/phpunit/php-code-coverage/Tests/_files/CoveredClass.php
vendored
Normal file
36
includes/kohana/vendor/phpunit/php-code-coverage/Tests/_files/CoveredClass.php
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
class CoveredParentClass
|
||||
{
|
||||
private function privateMethod()
|
||||
{
|
||||
}
|
||||
|
||||
protected function protectedMethod()
|
||||
{
|
||||
$this->privateMethod();
|
||||
}
|
||||
|
||||
public function publicMethod()
|
||||
{
|
||||
$this->protectedMethod();
|
||||
}
|
||||
}
|
||||
|
||||
class CoveredClass extends CoveredParentClass
|
||||
{
|
||||
private function privateMethod()
|
||||
{
|
||||
}
|
||||
|
||||
protected function protectedMethod()
|
||||
{
|
||||
parent::protectedMethod();
|
||||
$this->privateMethod();
|
||||
}
|
||||
|
||||
public function publicMethod()
|
||||
{
|
||||
parent::publicMethod();
|
||||
$this->protectedMethod();
|
||||
}
|
||||
}
|
4
includes/kohana/vendor/phpunit/php-code-coverage/Tests/_files/CoveredFunction.php
vendored
Normal file
4
includes/kohana/vendor/phpunit/php-code-coverage/Tests/_files/CoveredFunction.php
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
function globalFunction()
|
||||
{
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
class NamespaceCoverageClassExtendedTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @covers Foo\CoveredClass<extended>
|
||||
*/
|
||||
public function testSomething()
|
||||
{
|
||||
$o = new Foo\CoveredClass;
|
||||
$o->publicMethod();
|
||||
}
|
||||
}
|
12
includes/kohana/vendor/phpunit/php-code-coverage/Tests/_files/NamespaceCoverageClassTest.php
vendored
Normal file
12
includes/kohana/vendor/phpunit/php-code-coverage/Tests/_files/NamespaceCoverageClassTest.php
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
class NamespaceCoverageClassTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @covers Foo\CoveredClass
|
||||
*/
|
||||
public function testSomething()
|
||||
{
|
||||
$o = new Foo\CoveredClass;
|
||||
$o->publicMethod();
|
||||
}
|
||||
}
|
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
/**
|
||||
* @coversDefaultClass \Foo\CoveredClass
|
||||
*/
|
||||
class NamespaceCoverageCoversClassPublicTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @covers ::publicMethod
|
||||
*/
|
||||
public function testSomething()
|
||||
{
|
||||
$o = new Foo\CoveredClass;
|
||||
$o->publicMethod();
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
/**
|
||||
* @coversDefaultClass \Foo\CoveredClass
|
||||
*/
|
||||
class NamespaceCoverageCoversClassTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @covers ::privateMethod
|
||||
* @covers ::protectedMethod
|
||||
* @covers ::publicMethod
|
||||
* @covers \Foo\CoveredParentClass::privateMethod
|
||||
* @covers \Foo\CoveredParentClass::protectedMethod
|
||||
* @covers \Foo\CoveredParentClass::publicMethod
|
||||
*/
|
||||
public function testSomething()
|
||||
{
|
||||
$o = new Foo\CoveredClass;
|
||||
$o->publicMethod();
|
||||
}
|
||||
}
|
||||
|
12
includes/kohana/vendor/phpunit/php-code-coverage/Tests/_files/NamespaceCoverageMethodTest.php
vendored
Normal file
12
includes/kohana/vendor/phpunit/php-code-coverage/Tests/_files/NamespaceCoverageMethodTest.php
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
class NamespaceCoverageMethodTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @covers Foo\CoveredClass::publicMethod
|
||||
*/
|
||||
public function testSomething()
|
||||
{
|
||||
$o = new Foo\CoveredClass;
|
||||
$o->publicMethod();
|
||||
}
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
class NamespaceCoverageNotPrivateTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @covers Foo\CoveredClass::<!private>
|
||||
*/
|
||||
public function testSomething()
|
||||
{
|
||||
$o = new Foo\CoveredClass;
|
||||
$o->publicMethod();
|
||||
}
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
class NamespaceCoverageNotProtectedTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @covers Foo\CoveredClass::<!protected>
|
||||
*/
|
||||
public function testSomething()
|
||||
{
|
||||
$o = new Foo\CoveredClass;
|
||||
$o->publicMethod();
|
||||
}
|
||||
}
|
12
includes/kohana/vendor/phpunit/php-code-coverage/Tests/_files/NamespaceCoverageNotPublicTest.php
vendored
Normal file
12
includes/kohana/vendor/phpunit/php-code-coverage/Tests/_files/NamespaceCoverageNotPublicTest.php
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
class NamespaceCoverageNotPublicTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @covers Foo\CoveredClass::<!public>
|
||||
*/
|
||||
public function testSomething()
|
||||
{
|
||||
$o = new Foo\CoveredClass;
|
||||
$o->publicMethod();
|
||||
}
|
||||
}
|
12
includes/kohana/vendor/phpunit/php-code-coverage/Tests/_files/NamespaceCoveragePrivateTest.php
vendored
Normal file
12
includes/kohana/vendor/phpunit/php-code-coverage/Tests/_files/NamespaceCoveragePrivateTest.php
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
class NamespaceCoveragePrivateTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @covers Foo\CoveredClass::<private>
|
||||
*/
|
||||
public function testSomething()
|
||||
{
|
||||
$o = new Foo\CoveredClass;
|
||||
$o->publicMethod();
|
||||
}
|
||||
}
|
12
includes/kohana/vendor/phpunit/php-code-coverage/Tests/_files/NamespaceCoverageProtectedTest.php
vendored
Normal file
12
includes/kohana/vendor/phpunit/php-code-coverage/Tests/_files/NamespaceCoverageProtectedTest.php
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
class NamespaceCoverageProtectedTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @covers Foo\CoveredClass::<protected>
|
||||
*/
|
||||
public function testSomething()
|
||||
{
|
||||
$o = new Foo\CoveredClass;
|
||||
$o->publicMethod();
|
||||
}
|
||||
}
|
12
includes/kohana/vendor/phpunit/php-code-coverage/Tests/_files/NamespaceCoveragePublicTest.php
vendored
Normal file
12
includes/kohana/vendor/phpunit/php-code-coverage/Tests/_files/NamespaceCoveragePublicTest.php
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
class NamespaceCoveragePublicTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @covers Foo\CoveredClass::<public>
|
||||
*/
|
||||
public function testSomething()
|
||||
{
|
||||
$o = new Foo\CoveredClass;
|
||||
$o->publicMethod();
|
||||
}
|
||||
}
|
38
includes/kohana/vendor/phpunit/php-code-coverage/Tests/_files/NamespaceCoveredClass.php
vendored
Normal file
38
includes/kohana/vendor/phpunit/php-code-coverage/Tests/_files/NamespaceCoveredClass.php
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
namespace Foo;
|
||||
|
||||
class CoveredParentClass
|
||||
{
|
||||
private function privateMethod()
|
||||
{
|
||||
}
|
||||
|
||||
protected function protectedMethod()
|
||||
{
|
||||
$this->privateMethod();
|
||||
}
|
||||
|
||||
public function publicMethod()
|
||||
{
|
||||
$this->protectedMethod();
|
||||
}
|
||||
}
|
||||
|
||||
class CoveredClass extends CoveredParentClass
|
||||
{
|
||||
private function privateMethod()
|
||||
{
|
||||
}
|
||||
|
||||
protected function protectedMethod()
|
||||
{
|
||||
parent::protectedMethod();
|
||||
$this->privateMethod();
|
||||
}
|
||||
|
||||
public function publicMethod()
|
||||
{
|
||||
parent::publicMethod();
|
||||
$this->protectedMethod();
|
||||
}
|
||||
}
|
24
includes/kohana/vendor/phpunit/php-code-coverage/Tests/_files/NotExistingCoveredElementTest.php
vendored
Normal file
24
includes/kohana/vendor/phpunit/php-code-coverage/Tests/_files/NotExistingCoveredElementTest.php
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
class NotExistingCoveredElementTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @covers NotExistingClass
|
||||
*/
|
||||
public function testOne()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers NotExistingClass::notExistingMethod
|
||||
*/
|
||||
public function testTwo()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers NotExistingClass::<public>
|
||||
*/
|
||||
public function testThree()
|
||||
{
|
||||
}
|
||||
}
|
17
includes/kohana/vendor/phpunit/php-code-coverage/Tests/_files/ignored-lines-clover.xml
vendored
Normal file
17
includes/kohana/vendor/phpunit/php-code-coverage/Tests/_files/ignored-lines-clover.xml
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<coverage generated="%i">
|
||||
<project timestamp="%i">
|
||||
<file name="%s/source_with_ignore.php">
|
||||
<class name="Foo" namespace="global">
|
||||
<metrics methods="1" coveredmethods="0" conditionals="0" coveredconditionals="0" statements="0" coveredstatements="0" elements="1" coveredelements="0"/>
|
||||
</class>
|
||||
<class name="Bar" namespace="global">
|
||||
<metrics methods="1" coveredmethods="0" conditionals="0" coveredconditionals="0" statements="0" coveredstatements="0" elements="1" coveredelements="0"/>
|
||||
</class>
|
||||
<line num="2" type="stmt" count="1"/>
|
||||
<line num="6" type="stmt" count="0"/>
|
||||
<metrics loc="38" ncloc="26" classes="2" methods="0" coveredmethods="0" conditionals="0" coveredconditionals="0" statements="2" coveredstatements="1" elements="2" coveredelements="1"/>
|
||||
</file>
|
||||
<metrics files="1" loc="38" ncloc="26" classes="2" methods="0" coveredmethods="0" conditionals="0" coveredconditionals="0" statements="2" coveredstatements="1" elements="2" coveredelements="1"/>
|
||||
</project>
|
||||
</coverage>
|
38
includes/kohana/vendor/phpunit/php-code-coverage/Tests/_files/source_with_ignore.php
vendored
Normal file
38
includes/kohana/vendor/phpunit/php-code-coverage/Tests/_files/source_with_ignore.php
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
if ($neverHappens) {
|
||||
// @codeCoverageIgnoreStart
|
||||
print '*';
|
||||
// @codeCoverageIgnoreEnd
|
||||
}
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
class Foo
|
||||
{
|
||||
public function bar()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
class Bar
|
||||
{
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function foo()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
function baz()
|
||||
{
|
||||
print '*'; // @codeCoverageIgnore
|
||||
}
|
||||
|
||||
interface Bor {
|
||||
|
||||
public function foo();
|
||||
|
||||
}
|
||||
|
20
includes/kohana/vendor/phpunit/php-code-coverage/Tests/_files/source_with_namespace.php
vendored
Normal file
20
includes/kohana/vendor/phpunit/php-code-coverage/Tests/_files/source_with_namespace.php
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
namespace bar\baz;
|
||||
|
||||
/**
|
||||
* Represents foo.
|
||||
*/
|
||||
class Foo
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $bar
|
||||
*/
|
||||
function &foo($bar)
|
||||
{
|
||||
$baz = function() {};
|
||||
$a = TRUE ? TRUE : FALSE;
|
||||
$b = "{$a}";
|
||||
$c = "${b}";
|
||||
}
|
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
/** Docblock */
|
||||
interface {
|
||||
public function bar();
|
||||
}
|
||||
|
||||
class Foo
|
||||
{
|
||||
public function bar()
|
||||
{
|
||||
}
|
||||
}
|
4
includes/kohana/vendor/phpunit/php-code-coverage/Tests/_files/source_without_ignore.php
vendored
Normal file
4
includes/kohana/vendor/phpunit/php-code-coverage/Tests/_files/source_without_ignore.php
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
if ($neverHappens) {
|
||||
print '*';
|
||||
}
|
18
includes/kohana/vendor/phpunit/php-code-coverage/Tests/_files/source_without_namespace.php
vendored
Normal file
18
includes/kohana/vendor/phpunit/php-code-coverage/Tests/_files/source_without_namespace.php
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
/**
|
||||
* Represents foo.
|
||||
*/
|
||||
class Foo
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $bar
|
||||
*/
|
||||
function &foo($bar)
|
||||
{
|
||||
$baz = function() {};
|
||||
$a = TRUE ? TRUE : FALSE;
|
||||
$b = "{$a}";
|
||||
$c = "${b}";
|
||||
}
|
Reference in New Issue
Block a user