Permalink
Browse files

factory is migrated, Service and data not yet.green test

  • Loading branch information...
1 parent 163b63d commit 55a5b7d6b86e7c7553c759e0ab2dac810c1ed6bd @liuggio committed Oct 31, 2012
@@ -31,7 +31,7 @@ public function process(ContainerBuilder $container)
// setterInjection
$collectorReference = new Reference($id);
$collectorDefinition = $container->getDefinition($id);
- $collectorDefinition->addMethodCall('setStatsDataFactory', array(new Reference('liuggio_stats_d_client.factory')));
+ $collectorDefinition->addMethodCall('setStatsdDataFactory', array(new Reference('liuggio_stats_d_client.factory')));
$collectorDefinition->addMethodCall('setStatsDataKey', array($collectorsEnabled[$id]));
// adding to this collector the the collection
$serviceDefinition->addMethodCall('add', array($collectorReference));
@@ -19,7 +19,7 @@ class ExceptionStatsCollector extends StatsCollector
public function collect(Request $request, Response $response, \Exception $exception = null)
{
if ...
- $statData = $this->getStatsDataFactory()->increment($this->getStatsDataKey());
+ $statData = $this->getStatsdDataFactory()->increment($this->getStatsDataKey());
$this->addStatsData($statData);
return true;
@@ -46,7 +46,7 @@ liuggio_stats_d_client:
Working with the `Service`
-------------
-### StatsDataFactory
+### StatsdDataFactory
This service creates the (StatsDataInterface) object to send
@@ -29,11 +29,11 @@ public function startQuery($sql, array $params = null, array $types = null)
return;
}
$key = sprintf('%s.%s', $this->getStatsDataKey(), $verb);
- if (null === $this->getStatsDataFactory()) {
+ if (null === $this->getStatsdDataFactory()) {
return;
}
- $statData = $this->getStatsDataFactory()->increment($key);
+ $statData = $this->getStatsdDataFactory()->increment($key);
$this->addStatsData($statData);
}
@@ -36,7 +36,7 @@ public function collect(Request $request, Response $response, \Exception $except
$key = sprintf('%s.exception', $this->getStatsDataKey());
- $statData = $this->getStatsDataFactory()->increment($key);
+ $statData = $this->getStatsdDataFactory()->increment($key);
$this->addStatsData($statData);
self::$counter++;
@@ -27,7 +27,7 @@ private function getMemoryUsage()
*/
public function collect(Request $request, Response $response, \Exception $exception = null)
{
- $statData = $this->getStatsDataFactory()->gauge($this->getStatsDataKey(), $this->getMemoryUsage());
+ $statData = $this->getStatsdDataFactory()->gauge($this->getStatsDataKey(), $this->getMemoryUsage());
$this->addStatsData($statData);
return true;
@@ -63,7 +63,7 @@ public function getStatsData()
}
/**
- * @param \Liuggio\StatsDClientBundle\Model\StatsDataInterface $statsData
+ * @param \Liuggio\StatsdClient\Entity\StatsdDataInterface $statsData
* @return mixed
*/
public function addStatsData(StatsdDataInterface $statsData)
@@ -34,7 +34,7 @@ public function collect(Request $request, Response $response, \Exception $except
} catch (AuthenticationCredentialsNotFoundException $exception) {
//do nothing
}
- $statData = $this->getStatsDataFactory()->increment($key);
+ $statData = $this->getStatsdDataFactory()->increment($key);
$this->addStatsData($statData);
return true;
@@ -18,7 +18,7 @@ class VisitorStatsCollector extends StatsCollector
*/
public function collect(Request $request, Response $response, \Exception $exception = null)
{
- $statData = $this->getStatsDataFactory()->increment($this->getStatsDataKey());
+ $statData = $this->getStatsdDataFactory()->increment($this->getStatsDataKey());
$this->addStatsData($statData);
return true;
}
@@ -1,92 +0,0 @@
-<?php
-
-namespace Liuggio\StatsDClientBundle\Tests\Service;
-
-
-use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
-
-use Liuggio\StatsdClient\Factory\StatsdDataFactory;;
-use Liuggio\StatsDClientBundle\Service\StatsDService;
-use Liuggio\StatsDClientBundle\Entity\StatsData;
-
-class StatsdDataFactoryTest extends WebTestCase
-{
- private $statsdDataFactory;
-
- public function setUp()
- {
- $this->statsdDataFactory = new StatsdDataFactory('\Liuggio\StatsdClient\Entity\StatsdData');
- }
-//
-// public function testCreateStatsData()
-// {
-// $key = 'key';
-// $value='val';
-//
-// $obj = $this->statsdDataFactory->createStatsData($key, $value);
-// $this->assertEquals($key, $obj->getKey());
-// $this->assertEquals($value, $obj->getValue());
-// }
-//
-// public function testCreateStatsDataTiming()
-// {
-// $key = 'key';
-// $value = microtime();
-// $valueFloat = (string) floatval($value);
-//
-// $obj = $this->statsdDataFactory->timing($key, $value);
-// $this->assertEquals($key, $obj->getKey());
-// $this->assertContains($valueFloat, $obj->getValue());
-// $this->assertContains('|ms', $obj->getValue());
-// }
-//
-//// public function testCreateStatsDataUpdate()
-//// {
-//// $key = 'key';
-//// $value = -1;
-//// $stringValue = (string) intval($value);
-////
-//// $obj = $this->statsdDataFactory->createStatsDataUpdate($key, $value);
-//// $this->assertEquals($key, $obj->getKey());
-//// $this->assertContains($stringValue, $obj->getValue());
-//// $this->assertContains('|c', $obj->getValue());
-//// }
-//
-// public function testCreateStatsDataGauge()
-// {
-// $key = 'key';
-// $value = 1000;
-// $stringValue = intval($value);
-//
-// $obj = $this->statsdDataFactory->gauge($key, $value);
-// $this->assertEquals($key, $obj->getKey());
-// $this->assertContains($stringValue, $obj->getValue());
-// $this->assertContains('|g', $obj->getValue());
-// }
-//
-// public function testCreateStatsDataDecrement()
-// {
-// $key = 'key';
-// $value = -1;
-// $stringValue = (string) intval($value);
-//
-// $obj = $this->statsdDataFactory->decrement($key);
-// $this->assertEquals($key, $obj->getKey());
-// $this->assertContains($stringValue, $obj->getValue());
-// $this->assertContains('|c', $obj->getValue());
-// }
-//
-// public function testCreateStatsDataIncrement()
-// {
-// $key = 'key';
-// $value = 1;
-// $stringValue = (string) intval($value);
-//
-// $obj = $this->statsdDataFactory->increment($key);
-// $this->assertEquals($key, $obj->getKey());
-// $this->assertContains($stringValue, $obj->getValue());
-// $this->assertContains('|c', $obj->getValue());
-// }
-
-
-}
@@ -22,7 +22,7 @@ public function mockStatsDFactory($compare)
->setMethods(array('increment'))
->getMock();
- $dataMock = $this->getMock('\Liuggio\StatsDClientBundle\Model\StatsDataInterface');
+ $dataMock = $this->getMock('\Liuggio\StatsdClient\Entity\StatsdDataInterface');
$statsDFactory->expects($this->any())
->method('increment')
@@ -19,12 +19,12 @@ class ExceptionStatsCollectorTest extends WebTestCase
public function mockStatsDFactory($compare)
{
$phpunit = $this;
- $statsDFactory = $this->getMockBuilder('Liuggio\StatsdClient\Factory\StatsdDataFactory')
+ $statsDFactory = $this->getMockBuilder('\Liuggio\StatsdClient\Factory\StatsdDataFactory')
->disableOriginalConstructor()
->setMethods(array('increment'))
->getMock();
- $dataMock = $this->getMock('Liuggio\StatsDClientBundle\Model\StatsDataInterface');
+ $dataMock = $this->getMock('\Liuggio\StatsdClient\Entity\StatsdDataInterface');
$statsDFactory->expects($this->any())
->method('increment')
@@ -18,12 +18,12 @@ class MemoryStatsCollectorTest extends WebTestCase
public function mockStatsDFactory($compare)
{
$phpunit = $this;
- $statsDFactory = $this->getMockBuilder('Liuggio\StatsdClient\Factory\StatsdDataFactory')
+ $statsDFactory = $this->getMockBuilder('\Liuggio\StatsdClient\Factory\StatsdDataFactory')
->disableOriginalConstructor()
->setMethods(array('gauge'))
->getMock();
- $dataMock = $this->getMock('Liuggio\StatsDClientBundle\Model\StatsDataInterface');
+ $dataMock = $this->getMock('\Liuggio\StatsdClient\Entity\StatsdDataInterface');
$statsDFactory->expects($this->any())
->method('gauge')
@@ -16,13 +16,12 @@ class UserStatsCollectorTest extends WebTestCase
public function mockStatsDFactory($compare)
{
$phpunit = $this;
- $statsDFactory = $this->getMockBuilder('Liuggio\StatsdClient\Factory\StatsdDataFactory')
+ $statsDFactory = $this->getMockBuilder('\Liuggio\StatsdClient\Factory\StatsdDataFactory')
->disableOriginalConstructor()
->setMethods(array('increment'))
->getMock();
- $dataMock = $this->getMock('Liuggio\StatsDClientBundle\Model\StatsDataInterface');
-
+ $dataMock = $this->getMock('\Liuggio\StatsdClient\Entity\StatsdDataInterface');
$statsDFactory->expects($this->any())
->method('increment')
->will($this->returnCallback(function ($input) use ($phpunit, $compare, $dataMock) {
@@ -16,12 +16,12 @@ class VisitorStatsCollectorTest extends WebTestCase
public function mockStatsDFactory($compare)
{
$phpunit = $this;
- $statsDFactory = $this->getMockBuilder('Liuggio\StatsdClient\Factory\StatsdDataFactory')
+ $statsDFactory = $this->getMockBuilder('\Liuggio\StatsdClient\Factory\StatsdDataFactory')
->disableOriginalConstructor()
->setMethods(array('increment'))
->getMock();
- $dataMock = $this->getMock('Liuggio\StatsDClientBundle\Model\StatsDataInterface');
+ $dataMock = $this->getMock('\Liuggio\StatsdClient\Entity\StatsdDataInterface');
$statsDFactory->expects($this->any())
->method('increment')

0 comments on commit 55a5b7d

Please sign in to comment.