diff options
author | Jaime Perez Crespo <jaime.perez@uninett.no> | 2016-02-03 13:22:50 +0100 |
---|---|---|
committer | Jaime Perez Crespo <jaime.perez@uninett.no> | 2016-02-03 13:22:50 +0100 |
commit | 68cba56c7f276c6f1f5ce434804bbcd0fd8129b2 (patch) | |
tree | d1d9fdfc60aba997b1963c4b59b1ae78da73f6e4 /tests/lib/SimpleSAML | |
parent | d32eb4a928f5f0e256202ca244cf141411e4489d (diff) | |
download | simplesamlphp-68cba56c7f276c6f1f5ce434804bbcd0fd8129b2.zip simplesamlphp-68cba56c7f276c6f1f5ce434804bbcd0fd8129b2.tar.gz simplesamlphp-68cba56c7f276c6f1f5ce434804bbcd0fd8129b2.tar.bz2 |
Add full test coverage to SimpleSAML\Utils\Config\Metadata::isHiddenFromDiscovery().
Diffstat (limited to 'tests/lib/SimpleSAML')
-rw-r--r-- | tests/lib/SimpleSAML/Utils/Config/MetadataTest.php | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/lib/SimpleSAML/Utils/Config/MetadataTest.php b/tests/lib/SimpleSAML/Utils/Config/MetadataTest.php index f01d9b8..8a77135 100644 --- a/tests/lib/SimpleSAML/Utils/Config/MetadataTest.php +++ b/tests/lib/SimpleSAML/Utils/Config/MetadataTest.php @@ -218,4 +218,40 @@ class Utils_MetadataTest extends PHPUnit_Framework_TestCase } $this->assertArrayNotHasKey('name', $parsed); } + + + /** + * Test \SimpleSAML\Utils\Config\Metadata::isHiddenFromDiscovery(). + */ + public function testIsHiddenFromDiscovery() + { + // test for success + $metadata = array( + 'EntityAttributes' => array( + \SimpleSAML\Utils\Config\Metadata::$ENTITY_CATEGORY => array( + \SimpleSAML\Utils\Config\Metadata::$HIDE_FROM_DISCOVERY, + ), + ), + ); + $this->assertTrue(\SimpleSAML\Utils\Config\Metadata::isHiddenFromDiscovery($metadata)); + + // test for failures + $this->assertFalse(\SimpleSAML\Utils\Config\Metadata::isHiddenFromDiscovery(array('foo'))); + $this->assertFalse(\SimpleSAML\Utils\Config\Metadata::isHiddenFromDiscovery(array( + 'EntityAttributes' => 'bar', + ))); + $this->assertFalse(\SimpleSAML\Utils\Config\Metadata::isHiddenFromDiscovery(array( + 'EntityAttributes' => array(), + ))); + $this->assertFalse(\SimpleSAML\Utils\Config\Metadata::isHiddenFromDiscovery(array( + 'EntityAttributes' => array( + \SimpleSAML\Utils\Config\Metadata::$ENTITY_CATEGORY => '', + ), + ))); + $this->assertFalse(\SimpleSAML\Utils\Config\Metadata::isHiddenFromDiscovery(array( + 'EntityAttributes' => array( + \SimpleSAML\Utils\Config\Metadata::$ENTITY_CATEGORY => array(), + ), + ))); + } } |