ExampleTest.php 0000664 00000000621 15123166221 0007510 0 ustar 00 <?php
use Illuminate\Foundation\Testing\WithoutMiddleware;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\DatabaseTransactions;
class ExampleTest extends TestCase
{
/**
* A basic functional test example.
*
* @return void
*/
public function testBasicExample()
{
$this->visit('/')
->see('Laravel');
}
}
TestCase.php 0000664 00000001035 15123166221 0006770 0 ustar 00 <?php
abstract class TestCase extends Illuminate\Foundation\Testing\TestCase
{
/**
* The base URL to use while testing the application.
*
* @var string
*/
protected $baseUrl = 'http://localhost';
/**
* Creates the application.
*
* @return \Illuminate\Foundation\Application
*/
public function createApplication()
{
$app = require __DIR__.'/../bootstrap/app.php';
$app->make(Illuminate\Contracts\Console\Kernel::class)->bootstrap();
return $app;
}
}
Bootstrap.php 0000664 00000005363 15125133770 0007247 0 ustar 00 <?php
/**
* Mockery
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://github.com/padraic/mockery/master/LICENSE
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to padraic@php.net so we can send you a copy immediately.
*
* @category Mockery
* @package Mockery
* @subpackage UnitTests
* @copyright Copyright (c) 2010-2014 Pádraic Brady (http://blog.astrumfutura.com)
* @license http://github.com/padraic/mockery/blob/master/LICENSE New BSD License
*/
/*
* Set error reporting to the level to which Mockery code must comply.
*/
error_reporting(E_ALL);
/*
* Determine the root, library, and tests directories of the framework
* distribution.
*/
$root = realpath(dirname(dirname(__FILE__)));
$library = "$root/library";
$tests = "$root/tests";
/**
* Check that --dev composer installation was done
*/
if (!file_exists($root . '/vendor/autoload.php')) {
throw new Exception(
'Please run "php composer.phar install --dev" in root directory '
. 'to setup unit test dependencies before running the tests'
);
}
/*
* Prepend the Mutateme library/ and tests/ directories to the
* include_path. This allows the tests to run out of the box and helps prevent
* loading other copies of the code and tests that would supercede
* this copy.
*/
$path = array(
$library, // required for `testCallingRegisterRegistersSelfAsSplAutoloaderFunction`
get_include_path(),
);
set_include_path(implode(PATH_SEPARATOR, $path));
require_once "$root/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest.php";
if (defined('TESTS_GENERATE_REPORT') && TESTS_GENERATE_REPORT === true &&
version_compare(PHPUnit_Runner_Version::id(), '3.1.6', '>=')) {
/*
* Add Mutateme library/ directory to the PHPUnit code coverage
* whitelist. This has the effect that only production code source files
* appear in the code coverage report and that all production code source
* files, even those that are not covered by a test yet, are processed.
*/
PHPUnit_Util_Filter::addDirectoryToWhitelist($library);
/*
* Omit from code coverage reports the contents of the tests directory
*/
foreach (array('.php', '.phtml', '.csv', '.inc') as $suffix) {
PHPUnit_Util_Filter::addDirectoryToFilter($tests, $suffix);
}
PHPUnit_Util_Filter::addDirectoryToFilter(PEAR_INSTALL_DIR);
PHPUnit_Util_Filter::addDirectoryToFilter(PHP_LIBDIR);
}
require __DIR__.'/../vendor/autoload.php';
/*
* Unset global variables that are no longer needed.
*/
unset($root, $library, $tests, $path);
Mockery/MockingNullableMethodsTest.php 0000664 00000011660 15125133770 0014132 0 ustar 00 <?php
/**
* Mockery
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://github.com/padraic/mockery/master/LICENSE
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to padraic@php.net so we can send you a copy immediately.
*
* @category Mockery
* @package Mockery
* @subpackage UnitTests
* @copyright Copyright (c) 2010 Pádraic Brady (http://blog.astrumfutura.com)
* @license http://github.com/padraic/mockery/blob/master/LICENSE New BSD License
*/
namespace test\Mockery;
use Mockery\Adapter\Phpunit\MockeryTestCase;
use Mockery\Generator\Method;
use test\Mockery\Fixtures\MethodWithNullableReturnType;
/**
* @requires PHP 7.1.0RC3
*/
class MockingNullableMethodsTest extends MockeryTestCase
{
/**
* @var \Mockery\Container
*/
private $container;
protected function setUp()
{
require_once __DIR__."/Fixtures/MethodWithNullableReturnType.php";
$this->container = new \Mockery\Container;
}
protected function tearDown()
{
$this->container->mockery_close();
}
/**
* @test
*/
public function itShouldAllowNonNullableTypeToBeSet()
{
$mock = $this->container->mock('test\Mockery\Fixtures\MethodWithNullableReturnType');
$mock->shouldReceive('nonNullablePrimitive')->andReturn('a string');
$mock->nonNullablePrimitive();
}
/**
* @test
* @expectedException \TypeError
*/
public function itShouldNotAllowNonNullToBeNull()
{
$mock = $this->container->mock('test\Mockery\Fixtures\MethodWithNullableReturnType');
$mock->shouldReceive('nonNullablePrimitive')->andReturn(null);
$mock->nonNullablePrimitive();
}
/**
* @test
*/
public function itShouldAllowPrimitiveNullableToBeNull()
{
$mock = $this->container->mock('test\Mockery\Fixtures\MethodWithNullableReturnType');
$mock->shouldReceive('nullablePrimitive')->andReturn(null);
$mock->nullablePrimitive();
}
/**
* @test
*/
public function itShouldAllowPrimitiveNullabeToBeSet()
{
$mock = $this->container->mock('test\Mockery\Fixtures\MethodWithNullableReturnType');
$mock->shouldReceive('nullablePrimitive')->andReturn('a string');
$mock->nullablePrimitive();
}
/**
* @test
*/
public function itShouldAllowSelfToBeSet()
{
$mock = $this->container->mock('test\Mockery\Fixtures\MethodWithNullableReturnType');
$mock->shouldReceive('nonNullableSelf')->andReturn(new MethodWithNullableReturnType());
$mock->nonNullableSelf();
}
/**
* @test
* @expectedException \TypeError
*/
public function itShouldNotAllowSelfToBeNull()
{
$mock = $this->container->mock('test\Mockery\Fixtures\MethodWithNullableReturnType');
$mock->shouldReceive('nonNullableSelf')->andReturn(null);
$mock->nonNullableSelf();
}
/**
* @test
*/
public function itShouldAllowNullableSelfToBeSet()
{
$mock = $this->container->mock('test\Mockery\Fixtures\MethodWithNullableReturnType');
$mock->shouldReceive('nullableSelf')->andReturn(new MethodWithNullableReturnType());
$mock->nullableSelf();
}
/**
* @test
*/
public function itShouldAllowNullableSelfToBeNull()
{
$mock = $this->container->mock('test\Mockery\Fixtures\MethodWithNullableReturnType');
$mock->shouldReceive('nullableSelf')->andReturn(null);
$mock->nullableSelf();
}
/**
* @test
*/
public function itShouldAllowClassToBeSet()
{
$mock = $this->container->mock('test\Mockery\Fixtures\MethodWithNullableReturnType');
$mock->shouldReceive('nonNullableClass')->andReturn(new MethodWithNullableReturnType());
$mock->nonNullableClass();
}
/**
* @test
* @expectedException \TypeError
*/
public function itShouldNotAllowClassToBeNull()
{
$mock = $this->container->mock('test\Mockery\Fixtures\MethodWithNullableReturnType');
$mock->shouldReceive('nonNullableClass')->andReturn(null);
$mock->nonNullableClass();
}
/**
* @test
*/
public function itShouldAllowNullalbeClassToBeSet()
{
$mock = $this->container->mock('test\Mockery\Fixtures\MethodWithNullableReturnType');
$mock->shouldReceive('nullableClass')->andReturn(new MethodWithNullableReturnType());
$mock->nullableClass();
}
/**
* @test
*/
public function itShouldAllowNullableClassToBeNull()
{
$mock = $this->container->mock('test\Mockery\Fixtures\MethodWithNullableReturnType');
$mock->shouldReceive('nullableClass')->andReturn(null);
$mock->nullableClass();
}
}
Mockery/MockingVoidMethodsTest.php 0000664 00000002661 15125133770 0013276 0 ustar 00