Skip to content

Commit

Permalink
Merge pull request #57 from eux/master
Browse files Browse the repository at this point in the history
issue #28 license substitution in files
  • Loading branch information
leopro committed Jun 7, 2013
2 parents eb426d7 + 49d0c2c commit 5f8d3c8
Show file tree
Hide file tree
Showing 28 changed files with 220 additions and 59 deletions.
2 changes: 1 addition & 1 deletion app/config/config_dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ imports:
- { resource: config.yml }

services:
stats_listener:
stats_persister:
class: PUGX\StatsBundle\Service\NullPersister

framework:
Expand Down
17 changes: 8 additions & 9 deletions app/config/config_test.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
imports:
- { resource: config_dev.yml }


# for functional test
parameters:
image_creator.class: PUGX\BadgeBundle\Tests\Controller\FakeImageCreator
services:
statistic_listener:
class: PUGX\BadgeBundle\Service\Statistic\NullPersister

framework:
test: ~
session:
storage_id: session.storage.mock_file
profiler:
enabled: false
enabled: true

web_profiler:
toolbar: false
intercept_redirects: false

# for functional test
parameters:
image_creator.class: PUGX\BadgeBundle\Tests\Controller\FakeImageCreator
services:
stats_persister:
class: PUGX\StatsBundle\Service\NullPersister
10 changes: 5 additions & 5 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions src/PUGX/BadgeBundle/Controller/BadgeController.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php

/*
* This file is part of the badge-poser package
* This file is part of the badge-poser package.
*
* (c) Giulio De Donato <[email protected]>
* (c) PUGX <https://pugx.github.io/>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
5 changes: 3 additions & 2 deletions src/PUGX/BadgeBundle/Controller/PageController.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php

/*
* This file is part of the badge-poser package
* This file is part of the badge-poser package.
*
* (c) Giulio De Donato <[email protected]>
* (c) PUGX <https://pugx.github.io/>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
5 changes: 3 additions & 2 deletions src/PUGX/BadgeBundle/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php

/*
* This file is part of the badge-poser package
* This file is part of the badge-poser package.
*
* (c) Giulio De Donato <[email protected]>
* (c) PUGX <https://pugx.github.io/>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php

/*
* This file is part of the badge-poser package
* This file is part of the badge-poser package.
*
* (c) Giulio De Donato <[email protected]>
* (c) PUGX <https://pugx.github.io/>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
5 changes: 3 additions & 2 deletions src/PUGX/BadgeBundle/PUGXBadgeBundle.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php

/*
* This file is part of the badge-poser package
* This file is part of the badge-poser package.
*
* (c) Giulio De Donato <[email protected]>
* (c) PUGX <https://pugx.github.io/>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
5 changes: 3 additions & 2 deletions src/PUGX/BadgeBundle/Package/ApiPackageInterface.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php

/*
* This file is part of the badge-poser package
* This file is part of the badge-poser package.
*
* (c) Giulio De Donato <[email protected]>
* (c) PUGX <https://pugx.github.io/>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
5 changes: 3 additions & 2 deletions src/PUGX/BadgeBundle/Package/Package.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php

/*
* This file is part of the badge-poser package
* This file is part of the badge-poser package.
*
* (c) Giulio De Donato <[email protected]>
* (c) PUGX <https://pugx.github.io/>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
5 changes: 3 additions & 2 deletions src/PUGX/BadgeBundle/Package/PackageInterface.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php

/*
* This file is part of the badge-poser package
* This file is part of the badge-poser package.
*
* (c) Giulio De Donato <[email protected]>
* (c) PUGX <https://pugx.github.io/>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
5 changes: 3 additions & 2 deletions src/PUGX/BadgeBundle/Service/ImageCreator.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php

/*
* This file is part of the badge-poser package
* This file is part of the badge-poser package.
*
* (c) Giulio De Donato <[email protected]>
* (c) PUGX <https://pugx.github.io/>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
5 changes: 3 additions & 2 deletions src/PUGX/BadgeBundle/Service/ImageCreatorInterface.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php

/*
* This file is part of the badge-poser package
* This file is part of the badge-poser package.
*
* (c) Giulio De Donato <[email protected]>
* (c) PUGX <https://pugx.github.io/>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
9 changes: 9 additions & 0 deletions src/PUGX/BadgeBundle/Service/PackageManager.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
<?php

/*
* This file is part of the badge-poser package.
*
* (c) PUGX <https://pugx.github.io/>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace PUGX\BadgeBundle\Service;

use Packagist\Api\Client;
Expand Down
19 changes: 14 additions & 5 deletions src/PUGX/BadgeBundle/Tests/Controller/BadgeControllerTest.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php

/*
* This file is part of the badge-poser package
* This file is part of the badge-poser package.
*
* (c) Giulio De Donato <[email protected]>
* (c) PUGX <https://pugx.github.io/>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand All @@ -11,10 +12,13 @@
namespace PUGX\BadgeBundle\Tests\Controller;

use Packagist\Api\Client;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use PUGX\StatsBundle\Test\StatsFunctionalTest;
use PUGX\StatsBundle\Service\NullPersister;

class BadgeControllerTest extends WebTestCase
class BadgeControllerTest extends StatsFunctionalTest
{
protected $packagistClient;

// this setUp fake the request/response, if you comment this function the test'd run only with internet connection
public function setUp()
{
Expand All @@ -25,7 +29,6 @@ public function setUp()

private function createPackagistClient($data, $status = 200)
{

$packagistResponse = new \Guzzle\Http\Message\Response($status);
$packagistResponse->setBody($data);
$plugin = new \Guzzle\Plugin\Mock\MockPlugin();
Expand All @@ -42,6 +45,8 @@ public function testDownloadsAction()
static::$kernel->getContainer()->set('packagist_client', $this->packagistClient);
$crawler = $client->request('GET', '/pugx/badge-poser/d/total.png');
$this->assertTrue($client->getResponse()->isSuccessful());

$this->checkStatsCalls($client, 'pugx/badge-poser', 'downloadsAction');
}

public function testLatestStableAction()
Expand All @@ -51,6 +56,8 @@ public function testLatestStableAction()
$crawler = $client->request('GET', '/pugx/badge-poser/version.png');

$this->assertTrue($client->getResponse()->isSuccessful());

$this->checkStatsCalls($client, 'pugx/badge-poser', 'versionAction');
}

public function testLatestUnstableAction()
Expand All @@ -62,6 +69,8 @@ public function testLatestUnstableAction()
$this->assertTrue($client->getResponse()->isSuccessful());
$response = $client->getResponse();
$this->assertRegExp('/s-maxage=3600/', $response->headers->get('Cache-Control'));

$this->checkStatsCalls($client, 'pugx/badge-poser', 'versionAction');
}

public function testIfPackageDoesntExist()
Expand Down
5 changes: 3 additions & 2 deletions src/PUGX/BadgeBundle/Tests/Controller/FakeImageCreator.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php

/*
* This file is part of the badge-poser package
* This file is part of the badge-poser package.
*
* (c) Giulio De Donato <[email protected]>
* (c) PUGX <https://pugx.github.io/>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
13 changes: 9 additions & 4 deletions src/PUGX/BadgeBundle/Tests/Controller/PageControllerTest.php
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
<?php

/*
* This file is part of the badge-poser package
* This file is part of the badge-poser package.
*
* (c) Giulio De Donato <[email protected]>
* (c) PUGX <https://pugx.github.io/>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace PUGX\BadgeBundle\Tests\Controller;

use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use PUGX\StatsBundle\Test\StatsFunctionalTest;

class PageControllerTest extends WebTestCase
class PageControllerTest extends StatsFunctionalTest
{
public function testHomeAction()
{
$client = static::createClient();
$client->enableProfiler();

$crawler = $client->request('GET', '/');
$this->assertTrue($client->getResponse()->isSuccessful());
$this->assertEquals(1, $crawler->filter('#container h1:contains("Badge Poser")')->count());
Expand All @@ -27,5 +29,8 @@ public function testHomeAction()
$this->assertEquals(1, $crawler->filter('#container h4:contains("Monthly downloads")')->count());
$this->assertEquals(1, $crawler->filter('#container h4:contains("Latest Stable Version")')->count());
$this->assertEquals(1, $crawler->filter('#container h4:contains("Latest Unstable Version")')->count());

$this->checkStatsAreNotIncremented($client);
}

}
5 changes: 3 additions & 2 deletions src/PUGX/BadgeBundle/Tests/Service/ImageCreatorTest.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php

/*
* This file is part of the badge-poser package
* This file is part of the badge-poser package.
*
* (c) Giulio De Donato <[email protected]>
* (c) PUGX <https://pugx.github.io/>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
5 changes: 3 additions & 2 deletions src/PUGX/BadgeBundle/Tests/Service/PackageManagerTest.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php

/*
* This file is part of the badge-poser package
* This file is part of the badge-poser package.
*
* (c) Giulio De Donato <[email protected]>
* (c) PUGX <https://pugx.github.io/>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
9 changes: 9 additions & 0 deletions src/PUGX/StatsBundle/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
<?php

/*
* This file is part of the badge-poser package.
*
* (c) PUGX <https://pugx.github.io/>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace PUGX\StatsBundle\DependencyInjection;

use Symfony\Component\Config\Definition\Builder\TreeBuilder;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
<?php

/*
* This file is part of the badge-poser package.
*
* (c) PUGX <https://pugx.github.io/>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace PUGX\StatsBundle\DependencyInjection;

use Symfony\Component\DependencyInjection\ContainerBuilder;
Expand Down
5 changes: 3 additions & 2 deletions src/PUGX/StatsBundle/Listener/StatsListener.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php

/*
* This file is part of the badge-poser package
* This file is part of the badge-poser package.
*
* (c) Giulio De Donato <[email protected]>
* (c) PUGX <https://pugx.github.io/>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
9 changes: 9 additions & 0 deletions src/PUGX/StatsBundle/PUGXStatsBundle.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
<?php

/*
* This file is part of the badge-poser package.
*
* (c) PUGX <https://pugx.github.io/>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace PUGX\StatsBundle;

use Symfony\Component\HttpKernel\Bundle\Bundle;
Expand Down
Loading

0 comments on commit 5f8d3c8

Please sign in to comment.