~fkooman/php-saml-sp

b58b3e6730f737e6a5f7be43cdbcbde0c81cfd1b — Fran├žois Kooman 2 months ago 78601c9
remove some dead code and the associated tests
2 files changed, 0 insertions(+), 44 deletions(-)

M src/QueryParameters.php
M tests/QueryParametersTest.php
M src/QueryParameters.php => src/QueryParameters.php +0 -18
@@ 76,24 76,6 @@ class QueryParameters
        return new self($queryData);
    }

    public function requireQueryParameter(string $parameterName): string
    {
        if (null === $parameterValue = $this->optionalQueryParameter($parameterName)) {
            throw new QueryParametersException(\sprintf('query parameter "%s" missing', $parameterName));
        }

        return $parameterValue;
    }

    public function optionalQueryParameter(string $parameterName): ?string
    {
        if (!\array_key_exists($parameterName, $this->queryData)) {
            return null;
        }

        return $this->queryData[$parameterName];
    }

    public function add(string $parameterName, string $parameterValue): void
    {
        $this->queryData[$parameterName] = $parameterValue;

M tests/QueryParametersTest.php => tests/QueryParametersTest.php +0 -26
@@ 34,32 34,6 @@ use PHPUnit\Framework\TestCase;
 */
class QueryParametersTest extends TestCase
{
    public function testSimple(): void
    {
        $qp = QueryParameters::fromQueryString('foo=bar&bar=foo');
        $this->assertSame('bar', $qp->requireQueryParameter('foo'));
        $this->assertSame('foo', $qp->requireQueryParameter('bar'));
        $this->assertNull($qp->optionalQueryParameter('baz'));
    }

    public function testDuplicate(): void
    {
        $qp = QueryParameters::fromQueryString('foo=bar&foo=baz');
        $this->assertSame('baz', $qp->requireQueryParameter('foo'));
    }

    public function testEmptyValue(): void
    {
        $qp = QueryParameters::fromQueryString('foo');
        $this->assertSame('', $qp->requireQueryParameter('foo'));
    }

    public function testMultiEmpty(): void
    {
        $qp = QueryParameters::fromQueryString('foo===');
        $this->assertSame('==', $qp->requireQueryParameter('foo'));
    }

    public function testToString(): void
    {
        $qp = new QueryParameters(['foo' => 'bar', 'baz' => 'foobar']);