ConfigurationsUARulesTest.php 868 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: junade
  5. * Date: 19/09/2017
  6. * Time: 15:24
  7. */
  8. class ConfigurationsUARulesTest extends TestCase
  9. {
  10. public function testGetArray()
  11. {
  12. $configuration = new \Cloudflare\API\Configurations\UARules();
  13. $configuration->addUA('Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/603.2.4 (KHTML, like Gecko) Version/10.1.1 Safari/603.2.4');
  14. $array = $configuration->getArray();
  15. $this->assertCount(1, $array);
  16. $this->assertArrayHasKey('target', $array[0]);
  17. $this->assertEquals('ua', $array[0]['target']);
  18. $this->assertArrayHasKey('value', $array[0]);
  19. $this->assertEquals(
  20. 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/603.2.4 (KHTML, like Gecko) Version/10.1.1 Safari/603.2.4',
  21. $array[0]['value']
  22. );
  23. }
  24. }