OAuthTestUnitCommenCoreAutoLoaderTest

The Gravity Forms Salesforce Add-On OAuthTest Unit Commen Core AutoLoaderTest class.

Defined (1)

The class is defined in the following location(s).

/lib/PHPoAuthLib/tests/Unit/Common/AutoloaderTest.php  
  1. class AutoLoaderTest extends \PHPUnit_Framework_TestCase 
  2. /** 
  3. * @covers OAuth\Common\AutoLoader::__construct 
  4. * @covers OAuth\Common\AutoLoader::register 
  5. */ 
  6. public function testRegister() 
  7. $autoloader = new AutoLoader('Test', '/'); 
  8.  
  9. $this->assertTrue($autoloader->register()); 
  10.  
  11. /** 
  12. * @covers OAuth\Common\AutoLoader::__construct 
  13. * @covers OAuth\Common\AutoLoader::register 
  14. * @covers OAuth\Common\AutoLoader::unregister 
  15. */ 
  16. public function testUnregister() 
  17. $autoloader = new AutoLoader('Test', '/'); 
  18.  
  19. $this->assertTrue($autoloader->register()); 
  20. $this->assertTrue($autoloader->unregister()); 
  21.  
  22. /** 
  23. * @covers OAuth\Common\AutoLoader::__construct 
  24. * @covers OAuth\Common\AutoLoader::register 
  25. * @covers OAuth\Common\AutoLoader::load 
  26. */ 
  27. public function testLoadSuccess() 
  28. $autoloader = new AutoLoader('FakeProject', dirname(__DIR__) . '/../Mocks/Common'); 
  29.  
  30. $this->assertTrue($autoloader->register()); 
  31.  
  32. $someClass = new \FakeProject\NS\SomeClass(); 
  33.  
  34. $this->assertTrue($someClass->isLoaded()); 
  35.  
  36. /** 
  37. * @covers OAuth\Common\AutoLoader::__construct 
  38. * @covers OAuth\Common\AutoLoader::register 
  39. * @covers OAuth\Common\AutoLoader::load 
  40. */ 
  41. public function testLoadSuccessExtraSlashedNamespace() 
  42. $autoloader = new AutoLoader('\\\\FakeProject', dirname(__DIR__) . '/../Mocks/Common'); 
  43.  
  44. $this->assertTrue($autoloader->register()); 
  45.  
  46. $someClass = new \FakeProject\NS\SomeClass(); 
  47.  
  48. $this->assertTrue($someClass->isLoaded()); 
  49.  
  50. /** 
  51. * @covers OAuth\Common\AutoLoader::__construct 
  52. * @covers OAuth\Common\AutoLoader::register 
  53. * @covers OAuth\Common\AutoLoader::load 
  54. */ 
  55. public function testLoadSuccessExtraForwardSlashedPath() 
  56. $autoloader = new AutoLoader('FakeProject', dirname(__DIR__) . '/../Mocks/Common//'); 
  57.  
  58. $this->assertTrue($autoloader->register()); 
  59.  
  60. $someClass = new \FakeProject\NS\SomeClass(); 
  61.  
  62. $this->assertTrue($someClass->isLoaded()); 
  63.  
  64. /** 
  65. * @covers OAuth\Common\AutoLoader::__construct 
  66. * @covers OAuth\Common\AutoLoader::register 
  67. * @covers OAuth\Common\AutoLoader::load 
  68. */ 
  69. public function testLoadSuccessExtraBackwardSlashedPath() 
  70. $autoloader = new AutoLoader('FakeProject', dirname(__DIR__) . '/../Mocks/Common\\'); 
  71.  
  72. $this->assertTrue($autoloader->register()); 
  73.  
  74. $someClass = new \FakeProject\NS\SomeClass(); 
  75.  
  76. $this->assertTrue($someClass->isLoaded()); 
  77.  
  78. /** 
  79. * @covers OAuth\Common\AutoLoader::__construct 
  80. * @covers OAuth\Common\AutoLoader::register 
  81. * @covers OAuth\Common\AutoLoader::load 
  82. */ 
  83. public function testLoadSuccessExtraMixedSlashedPath() 
  84. $autoloader = new AutoLoader('FakeProject', dirname(__DIR__) . '/../Mocks/Common\\\\/\\//'); 
  85.  
  86. $this->assertTrue($autoloader->register()); 
  87.  
  88. $someClass = new \FakeProject\NS\SomeClass(); 
  89.  
  90. $this->assertTrue($someClass->isLoaded()); 
  91.  
  92. /** 
  93. * @covers OAuth\Common\AutoLoader::__construct 
  94. * @covers OAuth\Common\AutoLoader::register 
  95. * @covers OAuth\Common\AutoLoader::load 
  96. */ 
  97. public function testLoadUnknownClass() 
  98. $autoloader = new AutoLoader('FakeProject', dirname(__DIR__) . '/../Mocks/Common\\\\/\\//'); 
  99.  
  100. $this->assertTrue($autoloader->register()); 
  101.  
  102. $this->assertFalse($autoloader->load('IDontExistClass'));