PHP code example of cirrusidentity / simplesamlphp-test-utils

1. Go to this page and download the library: Download cirrusidentity/simplesamlphp-test-utils library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

cirrusidentity / simplesamlphp-test-utils example snippets


use AspectMock\Test as test;
...
    protected function tearDown() {
        test::clean(); // remove all registered test doubles
    }

        // Enable throwing an exception when redirects would normally be called.
        MockHttp::throwOnRedirectTrustedURL();
        $params = [
            'state' => '1234'
        ];
        try {
            HTTP::redirectTrustedURL('http://my.url.com', $params);
            $this->fail('Exception expected');
        } catch (RedirectException $e) {
            $this->assertEquals('redirectTrustedURL', $e->getMessage());
            $this->assertEquals('http://my.url.com', $e->getUrl());
            $this->assertEquals($params, $e->getParams());
        }