Add pear modules, mail and net_smtp via composer (#93)

Add pear modules, mail and net_smtp via composer, remove php 5.6 build due to phpunit 6
This commit is contained in:
Thilina Hasantha
2018-01-08 23:13:43 +01:00
committed by GitHub
parent 359e3f8382
commit e7792e7d79
2349 changed files with 117270 additions and 83170 deletions

View File

@@ -1,28 +1,49 @@
<?php
class Framework_MockObject_GeneratorTest extends PHPUnit_Framework_TestCase
/*
* This file is part of the phpunit-mock-objects package.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use PHPUnit\Framework\MockObject\Generator;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
/**
* @covers \PHPUnit\Framework\MockObject\Generator
*
* @uses \PHPUnit\Framework\MockObject\InvocationMocker
* @uses \PHPUnit\Framework\MockObject\Builder\InvocationMocker
* @uses \PHPUnit\Framework\MockObject\Invocation\ObjectInvocation
* @uses \PHPUnit\Framework\MockObject\Invocation\StaticInvocation
* @uses \PHPUnit\Framework\MockObject\Matcher
* @uses \PHPUnit\Framework\MockObject\Matcher\InvokedRecorder
* @uses \PHPUnit\Framework\MockObject\Matcher\MethodName
* @uses \PHPUnit\Framework\MockObject\Stub\ReturnStub
* @uses \PHPUnit\Framework\MockObject\Matcher\InvokedCount
*/
class GeneratorTest extends TestCase
{
/**
* @var PHPUnit_Framework_MockObject_Generator
* @var Generator
*/
protected $generator;
private $generator;
protected function setUp()
{
$this->generator = new PHPUnit_Framework_MockObject_Generator;
$this->generator = new Generator;
}
/**
* @covers PHPUnit_Framework_MockObject_Generator::getMock
* @expectedException PHPUnit_Framework_MockObject_RuntimeException
*/
public function testGetMockFailsWhenInvalidFunctionNameIsPassedInAsAFunctionToMock()
{
$this->expectException(\PHPUnit\Framework\MockObject\RuntimeException::class);
$this->generator->getMock(stdClass::class, [0]);
}
/**
* @covers PHPUnit_Framework_MockObject_Generator::getMock
*/
public function testGetMockCanCreateNonExistingFunctions()
{
$mock = $this->generator->getMock(stdClass::class, ['testFunction']);
@@ -30,19 +51,15 @@ class Framework_MockObject_GeneratorTest extends PHPUnit_Framework_TestCase
$this->assertTrue(method_exists($mock, 'testFunction'));
}
/**
* @covers PHPUnit_Framework_MockObject_Generator::getMock
* @expectedException PHPUnit_Framework_MockObject_RuntimeException
* @expectedExceptionMessage duplicates: "foo, bar, foo" (duplicate: "foo")
*/
public function testGetMockGeneratorFails()
{
$this->expectException(\PHPUnit\Framework\MockObject\RuntimeException::class);
$this->expectExceptionMessage('duplicates: "foo, bar, foo" (duplicate: "foo")');
$this->generator->getMock(stdClass::class, ['foo', 'bar', 'foo']);
}
/**
* @covers PHPUnit_Framework_MockObject_Generator::getMock
* @covers PHPUnit_Framework_MockObject_Generator::isMethodNameBlacklisted
* @requires PHP 7
*/
public function testGetMockBlacklistedMethodNamesPhp7()
@@ -53,9 +70,6 @@ class Framework_MockObject_GeneratorTest extends PHPUnit_Framework_TestCase
$this->assertInstanceOf(InterfaceWithSemiReservedMethodName::class, $mock);
}
/**
* @covers PHPUnit_Framework_MockObject_Generator::getMockForAbstractClass
*/
public function testGetMockForAbstractClassDoesNotFailWhenFakingInterfaces()
{
$mock = $this->generator->getMockForAbstractClass(Countable::class);
@@ -63,9 +77,6 @@ class Framework_MockObject_GeneratorTest extends PHPUnit_Framework_TestCase
$this->assertTrue(method_exists($mock, 'count'));
}
/**
* @covers PHPUnit_Framework_MockObject_Generator::getMockForAbstractClass
*/
public function testGetMockForAbstractClassStubbingAbstractClass()
{
$mock = $this->generator->getMockForAbstractClass(AbstractMockTestClass::class);
@@ -73,9 +84,6 @@ class Framework_MockObject_GeneratorTest extends PHPUnit_Framework_TestCase
$this->assertTrue(method_exists($mock, 'doSomething'));
}
/**
* @covers PHPUnit_Framework_MockObject_Generator::getMockForAbstractClass
*/
public function testGetMockForAbstractClassWithNonExistentMethods()
{
$mock = $this->generator->getMockForAbstractClass(
@@ -92,9 +100,6 @@ class Framework_MockObject_GeneratorTest extends PHPUnit_Framework_TestCase
$this->assertTrue(method_exists($mock, 'doSomething'));
}
/**
* @covers PHPUnit_Framework_MockObject_Generator::getMockForAbstractClass
*/
public function testGetMockForAbstractClassShouldCreateStubsOnlyForAbstractMethodWhenNoMethodsWereInformed()
{
$mock = $this->generator->getMockForAbstractClass(AbstractMockTestClass::class);
@@ -109,20 +114,18 @@ class Framework_MockObject_GeneratorTest extends PHPUnit_Framework_TestCase
/**
* @dataProvider getMockForAbstractClassExpectsInvalidArgumentExceptionDataprovider
* @covers PHPUnit_Framework_MockObject_Generator::getMockForAbstractClass
* @expectedException PHPUnit_Framework_Exception
*/
public function testGetMockForAbstractClassExpectingInvalidArgumentException($className, $mockClassName)
{
$this->expectException(PHPUnit\Framework\Exception::class);
$this->generator->getMockForAbstractClass($className, [], $mockClassName);
}
/**
* @covers PHPUnit_Framework_MockObject_Generator::getMockForAbstractClass
* @expectedException PHPUnit_Framework_MockObject_RuntimeException
*/
public function testGetMockForAbstractClassAbstractClassDoesNotExist()
{
$this->expectException(\PHPUnit\Framework\MockObject\RuntimeException::class);
$this->generator->getMockForAbstractClass('Tux');
}
@@ -134,9 +137,6 @@ class Framework_MockObject_GeneratorTest extends PHPUnit_Framework_TestCase
];
}
/**
* @covers PHPUnit_Framework_MockObject_Generator::getMockForTrait
*/
public function testGetMockForTraitWithNonExistentMethodsAndNonAbstractMethods()
{
$mock = $this->generator->getMockForTrait(
@@ -155,9 +155,6 @@ class Framework_MockObject_GeneratorTest extends PHPUnit_Framework_TestCase
$this->assertTrue($mock->anotherMockableMethod());
}
/**
* @covers PHPUnit_Framework_MockObject_Generator::getMockForTrait
*/
public function testGetMockForTraitStubbingAbstractMethod()
{
$mock = $this->generator->getMockForTrait(AbstractTrait::class);
@@ -172,18 +169,14 @@ class Framework_MockObject_GeneratorTest extends PHPUnit_Framework_TestCase
$this->assertInstanceOf('SingletonClass', $mock);
}
/**
* @covers PHPUnit_Framework_MockObject_Generator::getMock
* @expectedException PHPUnit_Framework_MockObject_RuntimeException
*/
public function testExceptionIsRaisedForMutuallyExclusiveOptions()
{
$this->expectException(\PHPUnit\Framework\MockObject\RuntimeException::class);
$this->generator->getMock(stdClass::class, [], [], '', false, true, true, true, true);
}
/**
* @covers PHPUnit_Framework_MockObject_Generator::getMock
*
* @requires PHP 7
*/
public function testCanImplementInterfacesThatHaveMethodsWithReturnTypes()
@@ -192,14 +185,9 @@ class Framework_MockObject_GeneratorTest extends PHPUnit_Framework_TestCase
$this->assertInstanceOf(AnInterfaceWithReturnType::class, $stub);
$this->assertInstanceOf(AnInterface::class, $stub);
$this->assertInstanceOf(PHPUnit_Framework_MockObject_MockObject::class, $stub);
$this->assertInstanceOf(MockObject::class, $stub);
}
/**
* @covers PHPUnit_Framework_MockObject_Generator::getMock
*
* @ticket https://github.com/sebastianbergmann/phpunit-mock-objects/issues/322
*/
public function testCanConfigureMethodsForDoubleOfNonExistentClass()
{
$className = 'X' . md5(microtime());
@@ -209,9 +197,6 @@ class Framework_MockObject_GeneratorTest extends PHPUnit_Framework_TestCase
$this->assertInstanceOf($className, $mock);
}
/**
* @covers PHPUnit_Framework_MockObject_Generator::getMock
*/
public function testCanInvokeMethodsOfNonExistentClass()
{
$className = 'X' . md5(microtime());