Kohana v3.3.0

This commit is contained in:
Deon George
2013-04-22 14:09:50 +10:00
commit f96694b18f
1280 changed files with 145034 additions and 0 deletions

View 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>

View 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();
}
}

View 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());
}
}

View File

@@ -0,0 +1,12 @@
<?php
class CoverageClassExtendedTest extends PHPUnit_Framework_TestCase
{
/**
* @covers CoveredClass<extended>
*/
public function testSomething()
{
$o = new CoveredClass;
$o->publicMethod();
}
}

View File

@@ -0,0 +1,12 @@
<?php
class CoverageClassTest extends PHPUnit_Framework_TestCase
{
/**
* @covers CoveredClass
*/
public function testSomething()
{
$o = new CoveredClass;
$o->publicMethod();
}
}

View File

@@ -0,0 +1,11 @@
<?php
class CoverageFunctionTest extends PHPUnit_Framework_TestCase
{
/**
* @covers ::globalFunction
*/
public function testSomething()
{
globalFunction();
}
}

View File

@@ -0,0 +1,12 @@
<?php
class CoverageMethodOneLineAnnotationTest extends PHPUnit_Framework_TestCase
{
/** @covers CoveredClass::publicMethod */
public function testSomething()
{
$o = new CoveredClass;
$o->publicMethod();
}
}

View File

@@ -0,0 +1,12 @@
<?php
class CoverageMethodTest extends PHPUnit_Framework_TestCase
{
/**
* @covers CoveredClass::publicMethod
*/
public function testSomething()
{
$o = new CoveredClass;
$o->publicMethod();
}
}

View File

@@ -0,0 +1,9 @@
<?php
class CoverageNoneTest extends PHPUnit_Framework_TestCase
{
public function testSomething()
{
$o = new CoveredClass;
$o->publicMethod();
}
}

View File

@@ -0,0 +1,12 @@
<?php
class CoverageNotPrivateTest extends PHPUnit_Framework_TestCase
{
/**
* @covers CoveredClass::<!private>
*/
public function testSomething()
{
$o = new CoveredClass;
$o->publicMethod();
}
}

View File

@@ -0,0 +1,12 @@
<?php
class CoverageNotProtectedTest extends PHPUnit_Framework_TestCase
{
/**
* @covers CoveredClass::<!protected>
*/
public function testSomething()
{
$o = new CoveredClass;
$o->publicMethod();
}
}

View File

@@ -0,0 +1,12 @@
<?php
class CoverageNotPublicTest extends PHPUnit_Framework_TestCase
{
/**
* @covers CoveredClass::<!public>
*/
public function testSomething()
{
$o = new CoveredClass;
$o->publicMethod();
}
}

View File

@@ -0,0 +1,13 @@
<?php
class CoverageNothingTest extends PHPUnit_Framework_TestCase
{
/**
* @covers CoveredClass::publicMethod
* @coversNothing
*/
public function testSomething()
{
$o = new CoveredClass;
$o->publicMethod();
}
}

View File

@@ -0,0 +1,12 @@
<?php
class CoveragePrivateTest extends PHPUnit_Framework_TestCase
{
/**
* @covers CoveredClass::<private>
*/
public function testSomething()
{
$o = new CoveredClass;
$o->publicMethod();
}
}

View File

@@ -0,0 +1,12 @@
<?php
class CoverageProtectedTest extends PHPUnit_Framework_TestCase
{
/**
* @covers CoveredClass::<protected>
*/
public function testSomething()
{
$o = new CoveredClass;
$o->publicMethod();
}
}

View File

@@ -0,0 +1,12 @@
<?php
class CoveragePublicTest extends PHPUnit_Framework_TestCase
{
/**
* @covers CoveredClass::<public>
*/
public function testSomething()
{
$o = new CoveredClass;
$o->publicMethod();
}
}

View File

@@ -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();
}
}

View 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();
}
}

View File

@@ -0,0 +1,4 @@
<?php
function globalFunction()
{
}

View File

@@ -0,0 +1,12 @@
<?php
class NamespaceCoverageClassExtendedTest extends PHPUnit_Framework_TestCase
{
/**
* @covers Foo\CoveredClass<extended>
*/
public function testSomething()
{
$o = new Foo\CoveredClass;
$o->publicMethod();
}
}

View File

@@ -0,0 +1,12 @@
<?php
class NamespaceCoverageClassTest extends PHPUnit_Framework_TestCase
{
/**
* @covers Foo\CoveredClass
*/
public function testSomething()
{
$o = new Foo\CoveredClass;
$o->publicMethod();
}
}

View File

@@ -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();
}
}

View File

@@ -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();
}
}

View 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();
}
}

View File

@@ -0,0 +1,12 @@
<?php
class NamespaceCoverageNotPrivateTest extends PHPUnit_Framework_TestCase
{
/**
* @covers Foo\CoveredClass::<!private>
*/
public function testSomething()
{
$o = new Foo\CoveredClass;
$o->publicMethod();
}
}

View File

@@ -0,0 +1,12 @@
<?php
class NamespaceCoverageNotProtectedTest extends PHPUnit_Framework_TestCase
{
/**
* @covers Foo\CoveredClass::<!protected>
*/
public function testSomething()
{
$o = new Foo\CoveredClass;
$o->publicMethod();
}
}

View 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();
}
}

View 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();
}
}

View 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();
}
}

View 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();
}
}

View 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();
}
}

View 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()
{
}
}

View 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>

View 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();
}

View 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}";
}

View File

@@ -0,0 +1,13 @@
<?php
/** Docblock */
interface {
public function bar();
}
class Foo
{
public function bar()
{
}
}

View File

@@ -0,0 +1,4 @@
<?php
if ($neverHappens) {
print '*';
}

View 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}";
}