Beispiel #1
0
 public function setUp()
 {
     parent::setUp();
     $this->url = 'http://www.google.com';
     $this->cdn_url = 'http://my-bucket-name.www.google.com/public/css/cool/style.css';
     $this->path = 'public/css/cool/style.css';
     $this->path_url = 'http://www.google.com/public/css/cool/style.css';
     $this->pased_url = parse_url($this->url);
     $this->m_console = M::mock('Symfony\\Component\\Console\\Output\\ConsoleOutput');
     $this->m_console->shouldReceive('writeln')->atLeast(2);
     $this->m_validator = M::mock('Vinelab\\Cdn\\Validators\\Contracts\\ProviderValidatorInterface');
     $this->m_validator->shouldReceive('validate');
     $this->m_helper = M::mock('Vinelab\\Cdn\\CdnHelper');
     $this->m_helper->shouldReceive('parseUrl')->andReturn($this->pased_url);
     $this->m_spl_file = M::mock('Symfony\\Component\\Finder\\SplFileInfo');
     $this->m_spl_file->shouldReceive('getPathname')->andReturn('vinelab/cdn/tests/Vinelab/Cdn/AwsS3ProviderTest.php');
     $this->m_spl_file->shouldReceive('getRealPath')->andReturn(__DIR__ . '/AwsS3ProviderTest.php');
     $this->p_awsS3Provider = M::mock('\\Vinelab\\Cdn\\Providers\\AwsS3Provider[connect]', array($this->m_console, $this->m_validator, $this->m_helper));
     $this->m_s3 = M::mock('Aws\\S3\\S3Client');
     $this->m_s3->shouldReceive('factory')->andReturn('Aws\\S3\\S3Client');
     $m_command = M::mock('Aws\\Command');
     $this->m_s3->shouldReceive('getCommand')->andReturn($m_command);
     $m_command1 = M::mock('Aws\\Result')->shouldIgnoreMissing();
     $this->m_s3->shouldReceive('listObjects')->andReturn($m_command1);
     $this->m_s3->shouldReceive('execute');
     $this->p_awsS3Provider->setS3Client($this->m_s3);
     $this->p_awsS3Provider->shouldReceive('connect')->andReturn(true);
 }
Beispiel #2
0
 public function setUp()
 {
     parent::setUp();
     $configuration_file = ['bypass' => false, 'default' => 'AwsS3', 'url' => 'https://s3.amazonaws.com', 'threshold' => 10, 'providers' => ['aws' => ['s3' => ['region' => 'rrrrrrrrrrrgggggggggnnnnn', 'version' => 'vvvvvvvvssssssssssnnnnnnn', 'buckets' => ['bbbuuuucccctttt' => '*'], 'acl' => 'public-read', 'cloudfront' => ['use' => false, 'cdn_url' => ''], 'version' => '1']]], 'include' => ['directories' => [__DIR__], 'extensions' => [], 'patterns' => []], 'exclude' => ['directories' => [], 'files' => [], 'extensions' => [], 'patterns' => [], 'hidden' => true]];
     $this->asset_path = 'foo/bar.php';
     $this->path_path = 'public/foo/bar.php';
     $this->asset_url = 'https://bucket.s3.amazonaws.com/public/foo/bar.php';
     $this->provider = M::mock('Vinelab\\Cdn\\Providers\\AwsS3Provider');
     $this->provider_factory = M::mock('Vinelab\\Cdn\\Contracts\\ProviderFactoryInterface');
     $this->provider_factory->shouldReceive('create')->once()->andReturn($this->provider);
     $this->helper = M::mock('Vinelab\\Cdn\\Contracts\\CdnHelperInterface');
     $this->helper->shouldReceive('getConfigurations')->once()->andReturn($configuration_file);
     $this->helper->shouldReceive('cleanPath')->andReturn($this->asset_path);
     $this->helper->shouldReceive('startsWith')->andReturn(true);
     $this->validator = new \Vinelab\Cdn\Validators\CdnFacadeValidator();
     $this->facade = new \Vinelab\Cdn\CdnFacade($this->provider_factory, $this->helper, $this->validator);
 }
Beispiel #3
0
 public function setUp()
 {
     parent::setUp();
     $this->m_spl_file_info = M::mock('Symfony\\Component\\Finder\\SplFileInfo');
 }
Beispiel #4
0
 public function setUp()
 {
     parent::setUp();
     $this->asset = new \Vinelab\Cdn\Asset();
 }
Beispiel #5
0
 public function setUp()
 {
     parent::setUp();
 }
Beispiel #6
0
 public function setUp()
 {
     parent::setUp();
     $this->provider_factory = new \Vinelab\Cdn\ProviderFactory();
 }