<?php

namespace AuthStack\SAMLServiceProvider\tests\units\Model;

use mageekguy\atoum;
use AuthStack\SAMLServiceProvider\Model\IdentityProvider as IdP;
use RobRichards\XMLSecLibs\XMLSecurityKey;

class IdentityProvider extends atoum
{
    public function testIdP()
    {
        $this->given($idp = new IdP('https://authstack'))
            ->then
            ->string($idp->getBaseUrl())->isEqualTo('https://www.authstack.co.uk')
            ->string($idp->getEntityID())->isEqualTo('https://authstack')
            ->string($idp->getSSOUrl())->isEqualTo('https://www.authstack.co.uk/saml2.0/sso')
            ->string($idp->getSSOBinding())->isEqualTo('urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST')
            ->string($idp->getLogoutURL())->isEqualTo('https://www.authstack.co.uk/saml2.0/slo')
            ->string($idp->getLogoutBinding())->isEqualTo('urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST')
            ->string($idp->getX509())->isEqualTo('MIIEHzCCAwegAwIBAgIJAM8jEAWFZSqCMA0GCSqGSIb3DQEBCwUAMIGlMQswCQYDVQQGEwJIUjERMA8GA1UECAwISHJ2YXRza2ExDzANBgNVBAcMBlphZ3JlYjEVMBMGA1UECgwMQnVja2hpbGwgTHRkMSEwHwYDVQQLDBhSZXNlYXJjaCBhbmQgRGV2ZWxvcG1lbnQxEjAQBgNVBAMMCU5pa29sYSBCLjEkMCIGCSqGSIb3DQEJARYVbmlrb2xhQGJ1Y2toaWxsLmNvLnVrMB4XDTE2MDEwNzE2MTU1OVoXDTI2MDEwNjE2MTU1OVowgaUxCzAJBgNVBAYTAkhSMREwDwYDVQQIDAhIcnZhdHNrYTEPMA0GA1UEBwwGWmFncmViMRUwEwYDVQQKDAxCdWNraGlsbCBMdGQxITAfBgNVBAsMGFJlc2VhcmNoIGFuZCBEZXZlbG9wbWVudDESMBAGA1UEAwwJTmlrb2xhIEIuMSQwIgYJKoZIhvcNAQkBFhVuaWtvbGFAYnVja2hpbGwuY28udWswggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDOEsQeMmLOaYQ6uIj14IejQP809WichslptUKWShQ/Rl/10GkHGKfS+gHRmcFpv7Ywgo3Cv8XOcQPJKw8xk7yDMfTetE+qbugQgbAK2xWkQx3J/5aQXx0KQdbp/hfHv78LrrSt5aaQs7Z+RJJ6v93tdo2/hs+mdXMEU6mo92lAcHwrpohNA9eYi/EtrW4Dt2tFJYVjKUlxMF5ER7il8OFG0Xu8Nzt0+jlfR21MLmf1ZlYweLnUB8BWh2Gw1WctuIpM9/Hk8p1ygrz4gm249fSqCQXvkSLN5nzqAykPMqEVH4pGzsXOFn+OSB2F1uL7rcmN4GRt8VSOqo34qbpdSJ0tAgMBAAGjUDBOMB0GA1UdDgQWBBQvDnmwB1zWoCEj75NX9Z5GaqnzMzAfBgNVHSMEGDAWgBQvDnmwB1zWoCEj75NX9Z5GaqnzMzAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBCwUAA4IBAQCKMf+7nl/gMneE6B34fpMB4ptpaTjNPrcljmJSNJ+Q2CWpgYKSMz9XahaHte4qDfsMD8kW445/2EHMnNBwU/qpzxf32reD+pqs87fw7OWk020J/n8f24jy/F0yByY6XwQVcFxYJuU7H1IpFGi4h8UXGwewvYcwiXlsGFyhSq8HTdTjyIje2mvMuHZZXrJjkWFF9yMpmUqayoh4BlviqXIsjlIWIXaJ40xdidMqHuVpJ7Eg2nRVwEGV3RDHH36pndsYCtBJ004P9g5qabQJASmHlYZURJxDIZ8rKI4WjHhmbPTaEgsjJkqb1KnQLuYSWSb4Xkhx1/3nAT3QozqQRXYC')
            ->object($idp->getPublicKey())->isInstanceOf(XMLSecurityKey::class)
            ->boolean($idp->wantsSignedReguests())->isTrue()
            ;
    }
}