Fix PSR-0 file naming

This commit is contained in:
Romain Neutron
2014-02-14 12:16:54 +01:00
parent 787e86aacf
commit c5d3f97258
83 changed files with 45 additions and 38 deletions

View File

@@ -0,0 +1,44 @@
<?php
use Alchemy\Phrasea\Core\PhraseaEvents;
use Symfony\Component\EventDispatcher\Event;
class api_v1_TimerTest extends \PhraseanetTestCase
{
public function testRegister()
{
$start = microtime(true);
$app = $this->loadApp();
$dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface');
$dispatcher->expects($this->exactly(9))
->method('addListener');
$app['dispatcher'] = $dispatcher;
$app->register(new API_V1_Timer());
$this->assertInstanceOf('Doctrine\Common\Collections\ArrayCollection', $app['api.timers']);
$this->assertGreaterThan($start, $app['api.timers.start']);
}
public function testTriggerEvent()
{
$app = $this->loadApp();
$app->register(new API_V1_Timer());
$app['dispatcher']->dispatch(PhraseaEvents::API_RESULT, new Event());
$timers = $app['api.timers']->toArray();
$this->assertCount(1, $timers);
$timer = array_pop($timers);
$this->assertArrayHasKey('name', $timer);
$this->assertArrayHasKey('memory', $timer);
$this->assertArrayHasKey('time', $timer);
$this->assertEquals(PhraseaEvents::API_RESULT, $timer['name']);
$this->assertGreaterThan(0, $timer['time']);
$this->assertGreaterThan(400000, $timer['memory']);
}
}