Skip to content

Commit

Permalink
Merge branch 'Sam-Burns-increase-phpunit-version'
Browse files Browse the repository at this point in the history
Closes #23
  • Loading branch information
akrabat committed May 7, 2017
2 parents af684c7 + d07c784 commit d4c8756
Show file tree
Hide file tree
Showing 12 changed files with 62 additions and 25 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"psr/http-message": "^1.0"
},
"require-dev": {
"phpunit/phpunit": "^5.0"
"phpunit/phpunit": "^5.7|^6.0"
},
"conflict": {
"slim/slim": "^3.0"
Expand Down
27 changes: 20 additions & 7 deletions tests/BodyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
*/
namespace Slim\Tests\Http;

use PHPUnit\Framework\TestCase;
use ReflectionProperty;
use Slim\Http\Body;

class BodyTest extends \PHPUnit_Framework_TestCase
class BodyTest extends TestCase
{
/**
* @var string
Expand Down Expand Up @@ -187,6 +188,9 @@ public function testTellAttached()
$this->assertEquals(10, $body->tell());
}

/**
* @expectedException \RuntimeException
*/
public function testTellDetachedThrowsRuntimeException()
{
$this->stream = $this->resourceFactory();
Expand All @@ -195,7 +199,6 @@ public function testTellDetachedThrowsRuntimeException()
$bodyStream->setAccessible(true);
$bodyStream->setValue($body, null);

$this->setExpectedException('\RuntimeException');
$body->tell();
}

Expand Down Expand Up @@ -310,13 +313,15 @@ public function testSeekAttached()
$this->assertEquals(10, ftell($this->stream));
}

/**
* @expectedException \RuntimeException
*/
public function testSeekDetachedThrowsRuntimeException()
{
$this->stream = $this->resourceFactory();
$body = new Body($this->stream);
$body->detach();

$this->setExpectedException('\RuntimeException');
$body->seek(10);
}

Expand All @@ -330,13 +335,15 @@ public function testRewindAttached()
$this->assertEquals(0, ftell($this->stream));
}

/**
* @expectedException \RuntimeException
*/
public function testRewindDetachedThrowsRuntimeException()
{
$this->stream = $this->resourceFactory();
$body = new Body($this->stream);
$body->detach();

$this->setExpectedException('\RuntimeException');
$body->rewind();
}

Expand All @@ -348,13 +355,15 @@ public function testReadAttached()
$this->assertEquals(substr($this->text, 0, 10), $body->read(10));
}

/**
* @expectedException \RuntimeException
*/
public function testReadDetachedThrowsRuntimeException()
{
$this->stream = $this->resourceFactory();
$body = new Body($this->stream);
$body->detach();

$this->setExpectedException('\RuntimeException');
$body->read(10);
}

Expand All @@ -370,13 +379,15 @@ public function testWriteAttached()
$this->assertEquals($this->text . 'foo', (string)$body);
}

/**
* @expectedException \RuntimeException
*/
public function testWriteDetachedThrowsRuntimeException()
{
$this->stream = $this->resourceFactory();
$body = new Body($this->stream);
$body->detach();

$this->setExpectedException('\RuntimeException');
$body->write('foo');
}

Expand All @@ -389,13 +400,15 @@ public function testGetContentsAttached()
$this->assertEquals(substr($this->text, 10), $body->getContents());
}

/**
* @expectedException \RuntimeException
*/
public function testGetContentsDetachedThrowsRuntimeException()
{
$this->stream = $this->resourceFactory();
$body = new Body($this->stream);
$body->detach();

$this->setExpectedException('\RuntimeException');
$body->getContents();
}
}
3 changes: 2 additions & 1 deletion tests/CollectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
*/
namespace Slim\Tests;

use PHPUnit\Framework\TestCase;
use ReflectionProperty;
use Slim\Http\Collection;

class CollectionTest extends \PHPUnit_Framework_TestCase
class CollectionTest extends TestCase
{
/**
* @var Collection
Expand Down
3 changes: 2 additions & 1 deletion tests/CookiesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
*/
namespace Slim\Tests\Http;

use PHPUnit\Framework\TestCase;
use ReflectionProperty;
use Slim\Http\Cookies;

class CookiesTest extends \PHPUnit_Framework_TestCase
class CookiesTest extends TestCase
{
// public function testArrayToString()
// {
Expand Down
3 changes: 2 additions & 1 deletion tests/EnvironmentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
*/
namespace Slim\Tests\Http;

use PHPUnit\Framework\TestCase;
use Slim\Http\Environment;

class EnvironmentTest extends \PHPUnit_Framework_TestCase
class EnvironmentTest extends TestCase
{
/**
* Server settings for the default HTTP request
Expand Down
3 changes: 2 additions & 1 deletion tests/HeadersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@
*/
namespace Slim\Tests\Http;

use PHPUnit\Framework\TestCase;
use ReflectionProperty;
use Slim\Http\Environment;
use Slim\Http\Headers;

class HeadersTest extends \PHPUnit_Framework_TestCase
class HeadersTest extends TestCase
{
public function testCreateFromEnvironment()
{
Expand Down
3 changes: 2 additions & 1 deletion tests/MessageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
*/
namespace Slim\Tests\Http;

use PHPUnit\Framework\TestCase;
use Slim\Http\Headers;
use Slim\Tests\Http\Mocks\MessageStub;

class MessageTest extends \PHPUnit_Framework_TestCase
class MessageTest extends TestCase
{
/*******************************************************************************
* Protocol
Expand Down
31 changes: 23 additions & 8 deletions tests/RequestBodyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
*/
namespace Slim\Tests\Http;

use PHPUnit\Framework\TestCase;
use ReflectionProperty;
use Slim\Http\RequestBody;

class RequestBodyTest extends \PHPUnit_Framework_TestCase
class RequestBodyTest extends TestCase
{
/** @var string */
protected $text = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.';
Expand Down Expand Up @@ -136,6 +137,9 @@ public function testToStringDetached()
$this->assertEquals('', (string)$this->body);
}

/**
* @expectedException \RuntimeException
*/
public function testClose()
{
$this->body->close();
Expand All @@ -145,7 +149,6 @@ public function testClose()
$this->assertFalse($this->body->isWritable());
$this->assertEquals('', (string)$this->body);

$this->setExpectedException('RuntimeException');
$this->body->tell();
}

Expand All @@ -170,13 +173,15 @@ public function testTellAttached()
$this->assertEquals(10, $this->body->tell());
}

/**
* @expectedException \RuntimeException
*/
public function testTellDetachedThrowsRuntimeException()
{
$bodyStream = new ReflectionProperty($this->body, 'stream');
$bodyStream->setAccessible(true);
$bodyStream->setValue($this->body, null);

$this->setExpectedException('\RuntimeException');
$this->body->tell();
}

Expand Down Expand Up @@ -250,11 +255,13 @@ public function testSeekAttached()
$this->assertEquals(10, $this->body->tell());
}

/**
* @expectedException \RuntimeException
*/
public function testSeekDetachedThrowsRuntimeException()
{
$this->body->detach();

$this->setExpectedException('\RuntimeException');
$this->body->seek(10);
}

Expand All @@ -266,11 +273,13 @@ public function testRewindAttached()
$this->assertEquals(0, $this->body->tell());
}

/**
* @expectedException \RuntimeException
*/
public function testRewindDetachedThrowsRuntimeException()
{
$this->body->detach();

$this->setExpectedException('\RuntimeException');
$this->body->rewind();
}

Expand All @@ -279,11 +288,13 @@ public function testReadAttached()
$this->assertEquals(substr($this->text, 0, 10), $this->body->read(10));
}

/**
* @expectedException \RuntimeException
*/
public function testReadDetachedThrowsRuntimeException()
{
$this->body->detach();

$this->setExpectedException('\RuntimeException');
$this->body->read(10);
}

Expand All @@ -297,11 +308,13 @@ public function testWriteAttached()
$this->assertEquals($this->text . 'foo', (string)$this->body);
}

/**
* @expectedException \RuntimeException
*/
public function testWriteDetachedThrowsRuntimeException()
{
$this->body->detach();

$this->setExpectedException('\RuntimeException');
$this->body->write('foo');
}

Expand All @@ -312,11 +325,13 @@ public function testGetContentsAttached()
$this->assertEquals(substr($this->text, 10), $this->body->getContents());
}

/**
* @expectedException \RuntimeException
*/
public function testGetContentsDetachedThrowsRuntimeException()
{
$this->body->detach();

$this->setExpectedException('\RuntimeException');
$this->body->getContents();
}
}
3 changes: 2 additions & 1 deletion tests/RequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

namespace Slim\Tests\Http;

use PHPUnit\Framework\TestCase;
use ReflectionProperty;
use Slim\Http\Collection;
use Slim\Http\Environment;
Expand All @@ -19,7 +20,7 @@
use Slim\Http\Uri;
use Slim\Http\FactoryDefault;

class RequestTest extends \PHPUnit_Framework_TestCase
class RequestTest extends TestCase
{
public function requestFactory(array $customGlobals = [])
{
Expand Down
3 changes: 2 additions & 1 deletion tests/ResponseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@
*/
namespace Slim\Tests\Http;

use PHPUnit\Framework\TestCase;
use ReflectionProperty;
use Slim\Http\Body;
use Slim\Http\Headers;
use Slim\Http\Response;

class ResponseTest extends \PHPUnit_Framework_TestCase
class ResponseTest extends TestCase
{
/*******************************************************************************
* Create
Expand Down
3 changes: 2 additions & 1 deletion tests/UploadedFilesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*/
namespace Slim\Tests\Http;

use PHPUnit\Framework\TestCase;
use Slim\Http\Environment;
use Slim\Http\Headers;
use Slim\Http\Request;
Expand All @@ -16,7 +17,7 @@
use Slim\Http\UploadedFile;
use Slim\Http\Uri;

class UploadedFilesTest extends \PHPUnit_Framework_TestCase
class UploadedFilesTest extends TestCase
{
static private $filename = './phpUxcOty';
/**
Expand Down
3 changes: 2 additions & 1 deletion tests/UriTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@
namespace Slim\Tests\Http;

use InvalidArgumentException;
use PHPUnit\Framework\TestCase;
use Slim\Http\Environment;
use Slim\Http\Uri;
use Slim\Http\FactoryDefault;

class UriTest extends \PHPUnit_Framework_TestCase
class UriTest extends TestCase
{
public function uriFactory(array $customGlobals = [])
{
Expand Down

0 comments on commit d4c8756

Please sign in to comment.