Skip to content

Commit

Permalink
Merge 07e48ea into ec3d622
Browse files Browse the repository at this point in the history
  • Loading branch information
nbayramberdiyev committed Feb 18, 2022
2 parents ec3d622 + 07e48ea commit 7720900
Show file tree
Hide file tree
Showing 15 changed files with 13 additions and 99 deletions.
14 changes: 0 additions & 14 deletions tests/BodyTest.php
Expand Up @@ -71,8 +71,6 @@ public function testConstructorAttachesStream()
$this->assertSame($this->stream, $bodyStream->getValue($body));
}

/**
*/
public function testConstructorInvalidStream()
{
$this->expectException(InvalidArgumentException::class);
Expand Down Expand Up @@ -204,8 +202,6 @@ public function testTellAttached()
$this->assertEquals(10, $body->tell());
}

/**
*/
public function testTellDetachedThrowsRuntimeException()
{
$this->expectException(RuntimeException::class);
Expand Down Expand Up @@ -330,8 +326,6 @@ public function testSeekAttached()
$this->assertEquals(10, ftell($this->stream));
}

/**
*/
public function testSeekDetachedThrowsRuntimeException()
{
$this->expectException(RuntimeException::class);
Expand All @@ -353,8 +347,6 @@ public function testRewindAttached()
$this->assertEquals(0, ftell($this->stream));
}

/**
*/
public function testRewindDetachedThrowsRuntimeException()
{
$this->expectException(RuntimeException::class);
Expand All @@ -374,8 +366,6 @@ public function testReadAttached()
$this->assertEquals(substr($this->text, 0, 10), $body->read(10));
}

/**
*/
public function testReadDetachedThrowsRuntimeException()
{
$this->expectException(RuntimeException::class);
Expand All @@ -399,8 +389,6 @@ public function testWriteAttached()
$this->assertEquals($this->text . 'foo', (string) $body);
}

/**
*/
public function testWriteDetachedThrowsRuntimeException()
{
$this->expectException(RuntimeException::class);
Expand All @@ -421,8 +409,6 @@ public function testGetContentsAttached()
$this->assertEquals(substr($this->text, 10), $body->getContents());
}

/**
*/
public function testGetContentsDetachedThrowsRuntimeException()
{
$this->expectException(RuntimeException::class);
Expand Down
2 changes: 0 additions & 2 deletions tests/CookiesTest.php
Expand Up @@ -267,8 +267,6 @@ public function testToHeader()
$this->assertEquals('test_date=Works; expires=' . $formattedStringDate, $cookieStringDate);
}

/**
*/
public function testParseHeaderException()
{
$this->expectException(InvalidArgumentException::class);
Expand Down
2 changes: 0 additions & 2 deletions tests/Factory/RequestFactoryTest.php
Expand Up @@ -36,8 +36,6 @@ protected function createUri($uri)
return (new UriFactory())->createUri($uri);
}

/**
*/
public function testCreateRequestThrowsExceptionWithInvalidUri()
{
$this->expectException(InvalidArgumentException::class);
Expand Down
4 changes: 0 additions & 4 deletions tests/Factory/ServerRequestFactoryTest.php
Expand Up @@ -197,8 +197,6 @@ public function testCreateFromGlobalsParsesBodyWithFragmentedContentType()
$this->assertEquals($_POST, $request->getParsedBody());
}

/**
*/
public function testCreateServerRequestWithNullAsUri()
{
$this->expectException(InvalidArgumentException::class);
Expand All @@ -207,8 +205,6 @@ public function testCreateServerRequestWithNullAsUri()
$this->createServerRequestFactory()->createServerRequest('GET', null, $env);
}

/**
*/
public function testCreateServerRequestWithInvalidUriObject()
{
$this->expectException(InvalidArgumentException::class);
Expand Down
6 changes: 0 additions & 6 deletions tests/Factory/StreamFactoryTest.php
Expand Up @@ -32,8 +32,6 @@ protected function createStreamFactory()
return new StreamFactory();
}

/**
*/
public function testCreateStreamThrowsRuntimeException()
{
$this->expectException(RuntimeException::class);
Expand All @@ -46,8 +44,6 @@ public function testCreateStreamThrowsRuntimeException()
$factory->createStream();
}

/**
*/
public function testCreateStreamFromFileThrowsRuntimeException()
{
$this->expectException(RuntimeException::class);
Expand All @@ -61,8 +57,6 @@ public function testCreateStreamFromFileThrowsRuntimeException()
$factory->createStreamFromFile('non-readable');
}

/**
*/
public function testCreateStreamFromResourceThrowsRuntimeException()
{
$this->expectException(InvalidArgumentException::class);
Expand Down
4 changes: 0 additions & 4 deletions tests/Factory/UploadedFileFactoryTest.php
Expand Up @@ -72,8 +72,6 @@ protected function prophesizeStreamInterfaceWithGetMetadataMethod(string $argKey
return $stream;
}

/**
*/
public function testCreateUploadedFileWithInvalidUri()
{
$this->expectException(InvalidArgumentException::class);
Expand All @@ -94,8 +92,6 @@ public function testCreateUploadedFileWithInvalidUri()
$this->factory->createUploadedFile($stream);
}

/**
*/
public function testCreateUploadedFileWithNonReadableFile()
{
$this->expectException(InvalidArgumentException::class);
Expand Down
2 changes: 0 additions & 2 deletions tests/HeaderTest.php
Expand Up @@ -60,8 +60,6 @@ public function testAddValuesString()
$this->assertSame($header2, $header);
}

/**
*/
public function testAddValuesNull()
{
$this->expectException(InvalidArgumentException::class);
Expand Down
10 changes: 5 additions & 5 deletions tests/HeadersTest.php
Expand Up @@ -57,8 +57,6 @@ public function testAddHeader()
$this->assertEquals(['Accept' => ['application/json', 'text/html']], $headers->getHeaders(true));
}

/**
*/
public function testAddHeaderValueEmptyArray()
{
$this->expectException(InvalidArgumentException::class);
Expand Down Expand Up @@ -106,8 +104,6 @@ public function testGetHeaderReturnsValidatedAndTrimedHeaderDefaultValue()
$this->assertEquals(['application/json'], $headers->getHeader('accept', ' application/json'));
}

/**
*/
public function testGetHeaderThrowsExceptionWithInvalidDefaultArgument()
{
$this->expectException(InvalidArgumentException::class);
Expand Down Expand Up @@ -199,11 +195,15 @@ public function testGetHeadersPreservesOriginalCase()

public function testParseAuthorizationHeader()
{
$expectedValue = 'Basic ' . base64_encode('user:password');

$headers = new Headers(['Authorization' => $expectedValue]);
$this->assertEquals([$expectedValue], $headers->getHeader('Authorization'));

$headers = new Headers([], ['REDIRECT_HTTP_AUTHORIZATION' => 'cookie']);
$this->assertEquals(['cookie'], $headers->getHeader('Authorization'));

$headers = new Headers([], ['PHP_AUTH_USER' => 'user', 'PHP_AUTH_PW' => 'password']);
$expectedValue = 'Basic ' . base64_encode('user' . ':' . 'password');
$this->assertEquals([$expectedValue], $headers->getHeader('Authorization'));

$headers = new Headers([], ['PHP_AUTH_DIGEST' => 'digest']);
Expand Down
2 changes: 0 additions & 2 deletions tests/MessageTest.php
Expand Up @@ -35,8 +35,6 @@ public function testWithProtocolVersion()
$this->assertEquals('1.0', $clone->protocolVersion);
}

/**
*/
public function testWithProtocolVersionInvalidThrowsException()
{
$this->expectException(InvalidArgumentException::class);
Expand Down
8 changes: 0 additions & 8 deletions tests/NonBufferedBodyTest.php
Expand Up @@ -125,8 +125,6 @@ public function testWithoutHeader()
self::assertSame([], HeaderStack::stack());
}

/**
*/
public function testCloseThrowsRuntimeException()
{
$this->expectException(RuntimeException::class);
Expand All @@ -135,8 +133,6 @@ public function testCloseThrowsRuntimeException()
(new NonBufferedBody())->close();
}

/**
*/
public function testSeekThrowsRuntimeException()
{
$this->expectException(RuntimeException::class);
Expand All @@ -145,8 +141,6 @@ public function testSeekThrowsRuntimeException()
(new NonBufferedBody())->seek(10);
}

/**
*/
public function testRewindThrowsRuntimeException()
{
$this->expectException(RuntimeException::class);
Expand All @@ -155,8 +149,6 @@ public function testRewindThrowsRuntimeException()
(new NonBufferedBody())->rewind();
}

/**
*/
public function testReadThrowsRuntimeException()
{
$this->expectException(RuntimeException::class);
Expand Down
12 changes: 0 additions & 12 deletions tests/RequestTest.php
Expand Up @@ -84,17 +84,13 @@ public function testWithAllAllowedCharactersMethod()
$this->assertEquals("!#$%&'*+.^_`|~09AZ-", $request->getMethod());
}

/**
*/
public function testWithMethodInvalid()
{
$this->expectException(InvalidArgumentException::class);

$this->requestFactory()->withMethod('B@R');
}

/**
*/
public function testCreateRequestWithInvalidMethodString()
{
$this->expectException(InvalidArgumentException::class);
Expand All @@ -108,8 +104,6 @@ public function testCreateRequestWithInvalidMethodString()
new Request('B@R', $uri, $headers, $cookies, $serverParams, $body);
}

/**
*/
public function testCreateRequestWithInvalidMethodOther()
{
$this->expectException(InvalidArgumentException::class);
Expand Down Expand Up @@ -155,8 +149,6 @@ public function testWithRequestTarget()
$this->assertEquals('/test?user=1', $clone->getRequestTarget());
}

/**
*/
public function testWithRequestTargetThatHasSpaces()
{
$this->expectException(InvalidArgumentException::class);
Expand Down Expand Up @@ -450,17 +442,13 @@ public function testGetParsedBodyReturnsNullWhenThereIsNoMediaTypeParserRegister
$this->assertNull($request->getParsedBody());
}

/**
*/
public function testWithParsedBodyInvalid()
{
$this->expectException(InvalidArgumentException::class);

$this->requestFactory()->withParsedBody(2);
}

/**
*/
public function testWithParsedBodyInvalidFalseValue()
{
$this->expectException(InvalidArgumentException::class);
Expand Down
7 changes: 2 additions & 5 deletions tests/ResponseTest.php
Expand Up @@ -17,6 +17,7 @@
use Slim\Psr7\Headers;
use Slim\Psr7\Response;
use Slim\Psr7\Stream;
use stdClass;

use function fopen;
use function property_exists;
Expand Down Expand Up @@ -96,8 +97,6 @@ public function testWithStatus()
$this->assertEquals(302, $clone->getStatusCode());
}

/**
*/
public function testWithStatusInvalidStatusCodeThrowsException()
{
$this->expectException(InvalidArgumentException::class);
Expand All @@ -106,8 +105,6 @@ public function testWithStatusInvalidStatusCodeThrowsException()
$response->withStatus(800);
}

/**
*/
public function testWithStatusInvalidReasonPhraseThrowsException()
{
$this->expectException(InvalidArgumentException::class);
Expand Down Expand Up @@ -144,7 +141,7 @@ public function testResonPhraseContainsLineFeed()

public function testWithStatusValidReasonPhraseObject()
{
$mock = $this->getMockBuilder('ResponseTestReasonPhrase')->setMethods(['__toString'])->getMock();
$mock = $this->getMockBuilder(stdClass::class)->addMethods(['__toString'])->getMock();
$mock->expects($this->once())
->method('__toString')
->will($this->returnValue('Slim OK'));
Expand Down
6 changes: 0 additions & 6 deletions tests/StreamTest.php
Expand Up @@ -73,8 +73,6 @@ public function testPipeIsNotSeekable()
$this->assertFalse($this->pipeStream->isSeekable());
}

/**
*/
public function testCannotSeekPipe()
{
$this->expectException(RuntimeException::class);
Expand All @@ -84,8 +82,6 @@ public function testCannotSeekPipe()
$this->pipeStream->seek(0);
}

/**
*/
public function testCannotTellPipe()
{
$this->expectException(RuntimeException::class);
Expand All @@ -95,8 +91,6 @@ public function testCannotTellPipe()
$this->pipeStream->tell();
}

/**
*/
public function testCannotRewindPipe()
{
$this->expectException(RuntimeException::class);
Expand Down
8 changes: 0 additions & 8 deletions tests/UploadedFileTest.php
Expand Up @@ -245,8 +245,6 @@ public function testMoveTo(UploadedFile $uploadedFile)
return $uploadedFile;
}

/**
*/
public function testMoveToRenameFailure()
{
$this->expectException(RuntimeException::class);
Expand Down Expand Up @@ -367,8 +365,6 @@ public function testMoveToStream()
}
}

/**
*/
public function testMoveToStreamCopyFailure()
{
$this->expectException(RuntimeException::class);
Expand Down Expand Up @@ -423,17 +419,13 @@ private function runFileUploadWithTempStreamTest(callable $streamFactory, callab
$this->assertSame($stream->getMetadata('uri'), $file->getFilePath());
}

/**
*/
public function testCreateUploadedFileWithInvalidArguments()
{
$this->expectException(InvalidArgumentException::class);

new UploadedFile(42); // a random value that is neither a string nor an instance of StreamInterface
}

/**
*/
public function testCreateUploadedFileWithInvalidUri()
{
$this->expectException(InvalidArgumentException::class);
Expand Down

0 comments on commit 7720900

Please sign in to comment.