Laravel version update

Laravel version update
This commit is contained in:
Manish Verma
2018-08-06 18:48:58 +05:30
parent d143048413
commit 126fbb0255
13678 changed files with 1031482 additions and 778530 deletions

View File

@@ -1,6 +1,6 @@
<?php
/*
* This file is part of the PHP_CodeCoverage package.
* This file is part of the php-code-coverage package.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
@@ -8,18 +8,29 @@
* file that was distributed with this source code.
*/
namespace SebastianBergmann\CodeCoverage;
use SebastianBergmann\CodeCoverage\Driver\Xdebug;
/**
* Abstract base class for test case classes.
*
* @since Class available since Release 1.0.0
*/
abstract class PHP_CodeCoverage_TestCase extends PHPUnit_Framework_TestCase
abstract class TestCase extends \PHPUnit\Framework\TestCase
{
protected static $TEST_TMP_PATH;
public static function setUpBeforeClass()
{
self::$TEST_TMP_PATH = TEST_FILES_PATH . 'tmp';
}
protected function getXdebugDataForBankAccount()
{
return array(
array(
TEST_FILES_PATH . 'BankAccount.php' => array(
return [
[
TEST_FILES_PATH . 'BankAccount.php' => [
8 => 1,
9 => -2,
13 => -1,
@@ -33,26 +44,26 @@ abstract class PHP_CodeCoverage_TestCase extends PHPUnit_Framework_TestCase
29 => -1,
31 => -1,
32 => -2
)
),
array(
TEST_FILES_PATH . 'BankAccount.php' => array(
]
],
[
TEST_FILES_PATH . 'BankAccount.php' => [
8 => 1,
13 => 1,
16 => 1,
29 => 1,
)
),
array(
TEST_FILES_PATH . 'BankAccount.php' => array(
]
],
[
TEST_FILES_PATH . 'BankAccount.php' => [
8 => 1,
13 => 1,
16 => 1,
22 => 1,
)
),
array(
TEST_FILES_PATH . 'BankAccount.php' => array(
]
],
[
TEST_FILES_PATH . 'BankAccount.php' => [
8 => 1,
13 => 1,
14 => 1,
@@ -62,16 +73,18 @@ abstract class PHP_CodeCoverage_TestCase extends PHPUnit_Framework_TestCase
24 => 1,
29 => 1,
31 => 1,
)
)
);
]
]
];
}
protected function getCoverageForBankAccount()
{
$data = $this->getXdebugDataForBankAccount();
require_once TEST_FILES_PATH . '/BankAccountTest.php';
$stub = $this->createMock(Xdebug::class);
$stub = $this->getMock('PHP_CodeCoverage_Driver_Xdebug');
$stub->expects($this->any())
->method('stop')
->will($this->onConsecutiveCalls(
@@ -81,49 +94,52 @@ abstract class PHP_CodeCoverage_TestCase extends PHPUnit_Framework_TestCase
$data[3]
));
$coverage = new PHP_CodeCoverage($stub, new PHP_CodeCoverage_Filter);
$filter = new Filter;
$filter->addFileToWhitelist(TEST_FILES_PATH . 'BankAccount.php');
$coverage = new CodeCoverage($stub, $filter);
$coverage->start(
new BankAccountTest('testBalanceIsInitiallyZero'),
new \BankAccountTest('testBalanceIsInitiallyZero'),
true
);
$coverage->stop(
true,
array(TEST_FILES_PATH . 'BankAccount.php' => range(6, 9))
[TEST_FILES_PATH . 'BankAccount.php' => range(6, 9)]
);
$coverage->start(
new BankAccountTest('testBalanceCannotBecomeNegative')
new \BankAccountTest('testBalanceCannotBecomeNegative')
);
$coverage->stop(
true,
array(TEST_FILES_PATH . 'BankAccount.php' => range(27, 32))
[TEST_FILES_PATH . 'BankAccount.php' => range(27, 32)]
);
$coverage->start(
new BankAccountTest('testBalanceCannotBecomeNegative2')
new \BankAccountTest('testBalanceCannotBecomeNegative2')
);
$coverage->stop(
true,
array(TEST_FILES_PATH . 'BankAccount.php' => range(20, 25))
[TEST_FILES_PATH . 'BankAccount.php' => range(20, 25)]
);
$coverage->start(
new BankAccountTest('testDepositWithdrawMoney')
new \BankAccountTest('testDepositWithdrawMoney')
);
$coverage->stop(
true,
array(
[
TEST_FILES_PATH . 'BankAccount.php' => array_merge(
range(6, 9),
range(20, 25),
range(27, 32)
)
)
]
);
return $coverage;
@@ -133,7 +149,8 @@ abstract class PHP_CodeCoverage_TestCase extends PHPUnit_Framework_TestCase
{
$data = $this->getXdebugDataForBankAccount();
$stub = $this->getMock('PHP_CodeCoverage_Driver_Xdebug');
$stub = $this->createMock(Xdebug::class);
$stub->expects($this->any())
->method('stop')
->will($this->onConsecutiveCalls(
@@ -141,25 +158,28 @@ abstract class PHP_CodeCoverage_TestCase extends PHPUnit_Framework_TestCase
$data[1]
));
$coverage = new PHP_CodeCoverage($stub, new PHP_CodeCoverage_Filter);
$filter = new Filter;
$filter->addFileToWhitelist(TEST_FILES_PATH . 'BankAccount.php');
$coverage = new CodeCoverage($stub, $filter);
$coverage->start(
new BankAccountTest('testBalanceIsInitiallyZero'),
new \BankAccountTest('testBalanceIsInitiallyZero'),
true
);
$coverage->stop(
true,
array(TEST_FILES_PATH . 'BankAccount.php' => range(6, 9))
[TEST_FILES_PATH . 'BankAccount.php' => range(6, 9)]
);
$coverage->start(
new BankAccountTest('testBalanceCannotBecomeNegative')
new \BankAccountTest('testBalanceCannotBecomeNegative')
);
$coverage->stop(
true,
array(TEST_FILES_PATH . 'BankAccount.php' => range(27, 32))
[TEST_FILES_PATH . 'BankAccount.php' => range(27, 32)]
);
return $coverage;
@@ -169,7 +189,8 @@ abstract class PHP_CodeCoverage_TestCase extends PHPUnit_Framework_TestCase
{
$data = $this->getXdebugDataForBankAccount();
$stub = $this->getMock('PHP_CodeCoverage_Driver_Xdebug');
$stub = $this->createMock(Xdebug::class);
$stub->expects($this->any())
->method('stop')
->will($this->onConsecutiveCalls(
@@ -177,30 +198,33 @@ abstract class PHP_CodeCoverage_TestCase extends PHPUnit_Framework_TestCase
$data[3]
));
$coverage = new PHP_CodeCoverage($stub, new PHP_CodeCoverage_Filter);
$filter = new Filter;
$filter->addFileToWhitelist(TEST_FILES_PATH . 'BankAccount.php');
$coverage = new CodeCoverage($stub, $filter);
$coverage->start(
new BankAccountTest('testBalanceCannotBecomeNegative2')
new \BankAccountTest('testBalanceCannotBecomeNegative2')
);
$coverage->stop(
true,
array(TEST_FILES_PATH . 'BankAccount.php' => range(20, 25))
[TEST_FILES_PATH . 'BankAccount.php' => range(20, 25)]
);
$coverage->start(
new BankAccountTest('testDepositWithdrawMoney')
new \BankAccountTest('testDepositWithdrawMoney')
);
$coverage->stop(
true,
array(
[
TEST_FILES_PATH . 'BankAccount.php' => array_merge(
range(6, 9),
range(20, 25),
range(27, 32)
)
)
]
);
return $coverage;
@@ -208,43 +232,46 @@ abstract class PHP_CodeCoverage_TestCase extends PHPUnit_Framework_TestCase
protected function getExpectedDataArrayForBankAccount()
{
return array(
TEST_FILES_PATH . 'BankAccount.php' => array(
8 => array(
return [
TEST_FILES_PATH . 'BankAccount.php' => [
8 => [
0 => 'BankAccountTest::testBalanceIsInitiallyZero',
1 => 'BankAccountTest::testDepositWithdrawMoney'
),
],
9 => null,
13 => array(),
14 => array(),
15 => array(),
16 => array(),
18 => array(),
22 => array(
13 => [],
14 => [],
15 => [],
16 => [],
18 => [],
22 => [
0 => 'BankAccountTest::testBalanceCannotBecomeNegative2',
1 => 'BankAccountTest::testDepositWithdrawMoney'
),
24 => array(
],
24 => [
0 => 'BankAccountTest::testDepositWithdrawMoney',
),
],
25 => null,
29 => array(
29 => [
0 => 'BankAccountTest::testBalanceCannotBecomeNegative',
1 => 'BankAccountTest::testDepositWithdrawMoney'
),
31 => array(
],
31 => [
0 => 'BankAccountTest::testDepositWithdrawMoney'
),
],
32 => null
)
);
]
];
}
protected function getCoverageForFileWithIgnoredLines()
{
$coverage = new PHP_CodeCoverage(
$filter = new Filter;
$filter->addFileToWhitelist(TEST_FILES_PATH . 'source_with_ignore.php');
$coverage = new CodeCoverage(
$this->setUpXdebugStubForFileWithIgnoredLines(),
new PHP_CodeCoverage_Filter
$filter
);
$coverage->start('FileWithIgnoredLines', true);
@@ -255,18 +282,19 @@ abstract class PHP_CodeCoverage_TestCase extends PHPUnit_Framework_TestCase
protected function setUpXdebugStubForFileWithIgnoredLines()
{
$stub = $this->getMock('PHP_CodeCoverage_Driver_Xdebug');
$stub = $this->createMock(Xdebug::class);
$stub->expects($this->any())
->method('stop')
->will($this->returnValue(
array(
TEST_FILES_PATH . 'source_with_ignore.php' => array(
[
TEST_FILES_PATH . 'source_with_ignore.php' => [
2 => 1,
4 => -1,
6 => -1,
7 => 1
)
)
]
]
));
return $stub;
@@ -274,9 +302,12 @@ abstract class PHP_CodeCoverage_TestCase extends PHPUnit_Framework_TestCase
protected function getCoverageForClassWithAnonymousFunction()
{
$coverage = new PHP_CodeCoverage(
$filter = new Filter;
$filter->addFileToWhitelist(TEST_FILES_PATH . 'source_with_class_and_anonymous_function.php');
$coverage = new CodeCoverage(
$this->setUpXdebugStubForClassWithAnonymousFunction(),
new PHP_CodeCoverage_Filter
$filter
);
$coverage->start('ClassWithAnonymousFunction', true);
@@ -287,12 +318,13 @@ abstract class PHP_CodeCoverage_TestCase extends PHPUnit_Framework_TestCase
protected function setUpXdebugStubForClassWithAnonymousFunction()
{
$stub = $this->getMock('PHP_CodeCoverage_Driver_Xdebug');
$stub = $this->createMock(Xdebug::class);
$stub->expects($this->any())
->method('stop')
->will($this->returnValue(
array(
TEST_FILES_PATH . 'source_with_class_and_anonymous_function.php' => array(
[
TEST_FILES_PATH . 'source_with_class_and_anonymous_function.php' => [
7 => 1,
9 => 1,
10 => -1,
@@ -302,8 +334,8 @@ abstract class PHP_CodeCoverage_TestCase extends PHPUnit_Framework_TestCase
14 => 1,
17 => 1,
18 => 1
)
)
]
]
));
return $stub;