@@ -25,14 +25,14 @@ discard block |
||
| 25 | 25 | */ |
| 26 | 26 | protected function setUp() |
| 27 | 27 | { |
| 28 | - if( class_exists( '\\TYPO3\\Flow\\Session\\Session' ) === false ) { |
|
| 29 | - $this->markTestSkipped( 'Class \\TYPO3\\Flow\\Session\\Session not found' ); |
|
| 28 | + if (class_exists('\\TYPO3\\Flow\\Session\\Session') === false) { |
|
| 29 | + $this->markTestSkipped('Class \\TYPO3\\Flow\\Session\\Session not found'); |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | $session = new \TYPO3\Flow\Session\TransientSession(); |
| 33 | 33 | $session->start(); |
| 34 | 34 | |
| 35 | - $this->object = new \Aimeos\MW\Session\Flow( $session ); |
|
| 35 | + $this->object = new \Aimeos\MW\Session\Flow($session); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | |
@@ -44,26 +44,26 @@ discard block |
||
| 44 | 44 | */ |
| 45 | 45 | protected function tearDown() |
| 46 | 46 | { |
| 47 | - unset( $this->object ); |
|
| 47 | + unset($this->object); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | |
| 51 | 51 | public function testGetDefault() |
| 52 | 52 | { |
| 53 | - $this->assertEquals( null, $this->object->get( 'notexist' ) ); |
|
| 53 | + $this->assertEquals(null, $this->object->get('notexist')); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | |
| 57 | 57 | public function testGetSet() |
| 58 | 58 | { |
| 59 | - $this->object->set( 'key', 'value' ); |
|
| 60 | - $this->assertEquals( 'value', $this->object->get( 'key' ) ); |
|
| 59 | + $this->object->set('key', 'value'); |
|
| 60 | + $this->assertEquals('value', $this->object->get('key')); |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | |
| 64 | 64 | public function testGetSetArray() |
| 65 | 65 | { |
| 66 | - $this->object->set( 'key', array( 'value' ) ); |
|
| 67 | - $this->assertEquals( array( 'value' ), $this->object->get( 'key' ) ); |
|
| 66 | + $this->object->set('key', array('value')); |
|
| 67 | + $this->assertEquals(array('value'), $this->object->get('key')); |
|
| 68 | 68 | } |
| 69 | 69 | } |
@@ -9,17 +9,17 @@ |
||
| 9 | 9 | * Set error reporting to maximum |
| 10 | 10 | */ |
| 11 | 11 | error_reporting( -1 ); |
| 12 | -ini_set( 'display_errors', '1' ); |
|
| 12 | +ini_set('display_errors', '1'); |
|
| 13 | 13 | |
| 14 | 14 | |
| 15 | 15 | /* |
| 16 | 16 | * Set locale settings to reasonable defaults |
| 17 | 17 | */ |
| 18 | -setlocale( LC_ALL, 'en_US.UTF-8' ); |
|
| 19 | -setlocale( LC_CTYPE, 'en_US.UTF-8' ); |
|
| 20 | -setlocale( LC_NUMERIC, 'POSIX' ); |
|
| 21 | -setlocale( LC_TIME, 'POSIX' ); |
|
| 22 | -date_default_timezone_set( 'UTC' ); |
|
| 18 | +setlocale(LC_ALL, 'en_US.UTF-8'); |
|
| 19 | +setlocale(LC_CTYPE, 'en_US.UTF-8'); |
|
| 20 | +setlocale(LC_NUMERIC, 'POSIX'); |
|
| 21 | +setlocale(LC_TIME, 'POSIX'); |
|
| 22 | +date_default_timezone_set('UTC'); |
|
| 23 | 23 | |
| 24 | 24 | require_once 'TestHelper.php'; |
| 25 | 25 | TestHelper::bootstrap(); |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | * |
| 30 | 30 | * @param \TYPO3\Flow\Log\SystemLoggerInterface $logger Flow logger object |
| 31 | 31 | */ |
| 32 | - public function __construct( \TYPO3\Flow\Log\SystemLoggerInterface $logger ) |
|
| 32 | + public function __construct(\TYPO3\Flow\Log\SystemLoggerInterface $logger) |
|
| 33 | 33 | { |
| 34 | 34 | $this->logger = $logger; |
| 35 | 35 | } |
@@ -44,18 +44,18 @@ discard block |
||
| 44 | 44 | * @throws \Aimeos\MW\Logger\Exception If an error occurs in Zend_Log |
| 45 | 45 | * @see \Aimeos\MW\Logger\Base for available log level constants |
| 46 | 46 | */ |
| 47 | - public function log( $message, $priority = \Aimeos\MW\Logger\Base::ERR, $facility = 'message' ) |
|
| 47 | + public function log($message, $priority = \Aimeos\MW\Logger\Base::ERR, $facility = 'message') |
|
| 48 | 48 | { |
| 49 | 49 | try |
| 50 | 50 | { |
| 51 | - if( !is_scalar( $message ) ) { |
|
| 52 | - $message = json_encode( $message ); |
|
| 51 | + if (!is_scalar($message)) { |
|
| 52 | + $message = json_encode($message); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - $this->logger->log( $message, $this->translatePriority( $priority ) ); |
|
| 55 | + $this->logger->log($message, $this->translatePriority($priority)); |
|
| 56 | 56 | } |
| 57 | - catch( \Exception $e ) { |
|
| 58 | - throw new \Aimeos\MW\Logger\Exception( $e->getMessage(), $e->getCode(), $e ); |
|
| 57 | + catch (\Exception $e) { |
|
| 58 | + throw new \Aimeos\MW\Logger\Exception($e->getMessage(), $e->getCode(), $e); |
|
| 59 | 59 | } |
| 60 | 60 | } |
| 61 | 61 | |
@@ -67,9 +67,9 @@ discard block |
||
| 67 | 67 | * @return integer Log level from Monolog\Logger |
| 68 | 68 | * @throws \Aimeos\MW\Logger\Exception If log level is unknown |
| 69 | 69 | */ |
| 70 | - protected function translatePriority( $priority ) |
|
| 70 | + protected function translatePriority($priority) |
|
| 71 | 71 | { |
| 72 | - switch( $priority ) |
|
| 72 | + switch ($priority) |
|
| 73 | 73 | { |
| 74 | 74 | case \Aimeos\MW\Logger\Base::EMERG: |
| 75 | 75 | return LOG_EMERG; |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | case \Aimeos\MW\Logger\Base::DEBUG: |
| 89 | 89 | return LOG_DEBUG; |
| 90 | 90 | default: |
| 91 | - throw new \Aimeos\MW\Logger\Exception( 'Invalid log level' ); |
|
| 91 | + throw new \Aimeos\MW\Logger\Exception('Invalid log level'); |
|
| 92 | 92 | } |
| 93 | 93 | } |
| 94 | 94 | } |
| 95 | 95 | \ No newline at end of file |
@@ -53,8 +53,7 @@ |
||
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | $this->logger->log( $message, $this->translatePriority( $priority ) ); |
| 56 | - } |
|
| 57 | - catch( \Exception $e ) { |
|
| 56 | + } catch( \Exception $e ) { |
|
| 58 | 57 | throw new \Aimeos\MW\Logger\Exception( $e->getMessage(), $e->getCode(), $e ); |
| 59 | 58 | } |
| 60 | 59 | } |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | * |
| 29 | 29 | * @param \TYPO3\Flow\Session\SessionInterface $object Flow session object |
| 30 | 30 | */ |
| 31 | - public function __construct( \TYPO3\Flow\Session\SessionInterface $object ) |
|
| 31 | + public function __construct(\TYPO3\Flow\Session\SessionInterface $object) |
|
| 32 | 32 | { |
| 33 | 33 | $this->object = $object; |
| 34 | 34 | } |
@@ -43,13 +43,13 @@ discard block |
||
| 43 | 43 | * @param mixed $default Value returned if requested key isn't found |
| 44 | 44 | * @return mixed Value associated to the requested key |
| 45 | 45 | */ |
| 46 | - public function get( $name, $default = null ) |
|
| 46 | + public function get($name, $default = null) |
|
| 47 | 47 | { |
| 48 | - if( $this->object->hasKey( $name ) !== true ) { |
|
| 48 | + if ($this->object->hasKey($name) !== true) { |
|
| 49 | 49 | return $default; |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - return $this->object->getData( $name ); |
|
| 52 | + return $this->object->getData($name); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | |
@@ -62,8 +62,8 @@ discard block |
||
| 62 | 62 | * @param mixed $value Value that should be associated with the given key |
| 63 | 63 | * @return void |
| 64 | 64 | */ |
| 65 | - public function set( $name, $value ) |
|
| 65 | + public function set($name, $value) |
|
| 66 | 66 | { |
| 67 | - $this->object->putData( $name, $value ); |
|
| 67 | + $this->object->putData($name, $value); |
|
| 68 | 68 | } |
| 69 | 69 | } |
@@ -31,9 +31,9 @@ discard block |
||
| 31 | 31 | * @param \TYPO3\Flow\Mvc\Routing\UriBuilder $builder Flow URI builder object |
| 32 | 32 | * @param array Associative list of fixed parameters that should be available for all routes |
| 33 | 33 | */ |
| 34 | - public function __construct( $view, \TYPO3\Flow\Mvc\Routing\UriBuilder $builder, array $fixed ) |
|
| 34 | + public function __construct($view, \TYPO3\Flow\Mvc\Routing\UriBuilder $builder, array $fixed) |
|
| 35 | 35 | { |
| 36 | - parent::__construct( $view ); |
|
| 36 | + parent::__construct($view); |
|
| 37 | 37 | |
| 38 | 38 | $this->builder = $builder; |
| 39 | 39 | $this->fixed = $fixed; |
@@ -51,19 +51,19 @@ discard block |
||
| 51 | 51 | * @param array $config Additional configuration parameter per URL |
| 52 | 52 | * @return string Complete URL that can be used in the template |
| 53 | 53 | */ |
| 54 | - public function transform( $target = null, $controller = null, $action = null, array $params = array(), array $trailing = array(), array $config = array() ) |
|
| 54 | + public function transform($target = null, $controller = null, $action = null, array $params = array(), array $trailing = array(), array $config = array()) |
|
| 55 | 55 | { |
| 56 | - $values = $this->getValues( $config ); |
|
| 56 | + $values = $this->getValues($config); |
|
| 57 | 57 | |
| 58 | 58 | $this->builder |
| 59 | 59 | ->reset() |
| 60 | - ->setSection( join( '/', $trailing ) ) |
|
| 61 | - ->setCreateAbsoluteUri( $values['absoluteUri'] ) |
|
| 62 | - ->setFormat( $values['format'] ); |
|
| 60 | + ->setSection(join('/', $trailing)) |
|
| 61 | + ->setCreateAbsoluteUri($values['absoluteUri']) |
|
| 62 | + ->setFormat($values['format']); |
|
| 63 | 63 | |
| 64 | 64 | $params['node'] = $target; |
| 65 | 65 | |
| 66 | - return $this->builder->uriFor( $action, $params + $this->fixed, $controller, $values['package'], $values['subpackage'] ); |
|
| 66 | + return $this->builder->uriFor($action, $params + $this->fixed, $controller, $values['package'], $values['subpackage']); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | * @param array $config Associative list of key/value pairs |
| 74 | 74 | * @return array Associative list of sanitized key/value pairs |
| 75 | 75 | */ |
| 76 | - protected function getValues( array $config ) |
|
| 76 | + protected function getValues(array $config) |
|
| 77 | 77 | { |
| 78 | 78 | $values = array( |
| 79 | 79 | 'package' => null, |
@@ -82,19 +82,19 @@ discard block |
||
| 82 | 82 | 'format' => 'html', |
| 83 | 83 | ); |
| 84 | 84 | |
| 85 | - if( isset( $config['package'] ) ) { |
|
| 85 | + if (isset($config['package'])) { |
|
| 86 | 86 | $values['package'] = (string) $config['package']; |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | - if( isset( $config['subpackage'] ) ) { |
|
| 89 | + if (isset($config['subpackage'])) { |
|
| 90 | 90 | $values['subpackage'] = (string) $config['subpackage']; |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | - if( isset( $config['absoluteUri'] ) ) { |
|
| 93 | + if (isset($config['absoluteUri'])) { |
|
| 94 | 94 | $values['absoluteUri'] = (bool) $config['absoluteUri']; |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | - if( isset( $config['format'] ) ) { |
|
| 97 | + if (isset($config['format'])) { |
|
| 98 | 98 | $values['format'] = (string) $config['format']; |
| 99 | 99 | } |
| 100 | 100 | |
@@ -25,18 +25,18 @@ discard block |
||
| 25 | 25 | */ |
| 26 | 26 | protected function setUp() |
| 27 | 27 | { |
| 28 | - if( class_exists( '\\TYPO3\\Flow\\Log\\Logger' ) === false ) { |
|
| 29 | - $this->markTestSkipped( 'Class \\TYPO3\\Flow\\Log\\Logger not found' ); |
|
| 28 | + if (class_exists('\\TYPO3\\Flow\\Log\\Logger') === false) { |
|
| 29 | + $this->markTestSkipped('Class \\TYPO3\\Flow\\Log\\Logger not found'); |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | $be = new \TYPO3\Flow\Log\Backend\FileBackend(); |
| 33 | - $be->setSeverityThreshold( LOG_ERR ); |
|
| 34 | - $be->setLogFileURL( 'flow.log' ); |
|
| 33 | + $be->setSeverityThreshold(LOG_ERR); |
|
| 34 | + $be->setLogFileURL('flow.log'); |
|
| 35 | 35 | |
| 36 | 36 | $log = new \TYPO3\Flow\Log\Logger(); |
| 37 | - $log->addBackend( $be ); |
|
| 37 | + $log->addBackend($be); |
|
| 38 | 38 | |
| 39 | - $this->object = new \Aimeos\MW\Logger\Flow( $log ); |
|
| 39 | + $this->object = new \Aimeos\MW\Logger\Flow($log); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | |
@@ -48,53 +48,53 @@ discard block |
||
| 48 | 48 | */ |
| 49 | 49 | protected function tearDown() |
| 50 | 50 | { |
| 51 | - @unlink( 'flow.log' ); |
|
| 51 | + @unlink('flow.log'); |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | |
| 55 | 55 | public function testLog() |
| 56 | 56 | { |
| 57 | - $this->object->log( 'error' ); |
|
| 58 | - $this->assertRegExp( '/^[^ ]+ [^ ]+ [0-9]+[ ]+ERROR[ ]+MW[ ]+error/', file_get_contents( 'flow.log' ) ); |
|
| 57 | + $this->object->log('error'); |
|
| 58 | + $this->assertRegExp('/^[^ ]+ [^ ]+ [0-9]+[ ]+ERROR[ ]+MW[ ]+error/', file_get_contents('flow.log')); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | |
| 62 | 62 | public function testNonScalarLog() |
| 63 | 63 | { |
| 64 | - $this->object->log( array( 'error', 'error2', 2 ) ); |
|
| 65 | - $this->assertRegExp( '/^[^ ]+ [^ ]+ [0-9]+[ ]+ERROR[ ]+MW[ ]+\["error","error2",2\]/', file_get_contents( 'flow.log' ) ); |
|
| 64 | + $this->object->log(array('error', 'error2', 2)); |
|
| 65 | + $this->assertRegExp('/^[^ ]+ [^ ]+ [0-9]+[ ]+ERROR[ ]+MW[ ]+\["error","error2",2\]/', file_get_contents('flow.log')); |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | |
| 69 | 69 | public function testLogDebug() |
| 70 | 70 | { |
| 71 | - $this->object->log( 'debug', \Aimeos\MW\Logger\Base::DEBUG ); |
|
| 72 | - $this->assertEquals( '', file_get_contents( 'flow.log' ) ); |
|
| 71 | + $this->object->log('debug', \Aimeos\MW\Logger\Base::DEBUG); |
|
| 72 | + $this->assertEquals('', file_get_contents('flow.log')); |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | |
| 76 | 76 | public function testBadPriority() |
| 77 | 77 | { |
| 78 | - $this->setExpectedException( '\\Aimeos\\MW\\Logger\\Exception' ); |
|
| 79 | - $this->object->log( 'error', -1 ); |
|
| 78 | + $this->setExpectedException('\\Aimeos\\MW\\Logger\\Exception'); |
|
| 79 | + $this->object->log('error', -1); |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | |
| 83 | 83 | public function testLogPriorityTranslate() |
| 84 | 84 | { |
| 85 | - $this->object->log( '', \Aimeos\MW\Logger\Base::EMERG ); |
|
| 86 | - $this->object->log( '', \Aimeos\MW\Logger\Base::ALERT ); |
|
| 87 | - $this->object->log( '', \Aimeos\MW\Logger\Base::CRIT ); |
|
| 88 | - $this->object->log( '', \Aimeos\MW\Logger\Base::ERR ); |
|
| 89 | - $this->object->log( '', \Aimeos\MW\Logger\Base::WARN ); |
|
| 90 | - $this->object->log( '', \Aimeos\MW\Logger\Base::NOTICE ); |
|
| 91 | - $this->object->log( '', \Aimeos\MW\Logger\Base::INFO ); |
|
| 92 | - $this->object->log( '', \Aimeos\MW\Logger\Base::DEBUG ); |
|
| 93 | - |
|
| 94 | - $content = file_get_contents( 'flow.log' ); |
|
| 95 | - $this->assertContains( 'EMERGENCY', $content ); |
|
| 96 | - $this->assertContains( 'ALERT', $content ); |
|
| 97 | - $this->assertContains( 'CRITICAL', $content ); |
|
| 98 | - $this->assertContains( 'ERROR', $content ); |
|
| 85 | + $this->object->log('', \Aimeos\MW\Logger\Base::EMERG); |
|
| 86 | + $this->object->log('', \Aimeos\MW\Logger\Base::ALERT); |
|
| 87 | + $this->object->log('', \Aimeos\MW\Logger\Base::CRIT); |
|
| 88 | + $this->object->log('', \Aimeos\MW\Logger\Base::ERR); |
|
| 89 | + $this->object->log('', \Aimeos\MW\Logger\Base::WARN); |
|
| 90 | + $this->object->log('', \Aimeos\MW\Logger\Base::NOTICE); |
|
| 91 | + $this->object->log('', \Aimeos\MW\Logger\Base::INFO); |
|
| 92 | + $this->object->log('', \Aimeos\MW\Logger\Base::DEBUG); |
|
| 93 | + |
|
| 94 | + $content = file_get_contents('flow.log'); |
|
| 95 | + $this->assertContains('EMERGENCY', $content); |
|
| 96 | + $this->assertContains('ALERT', $content); |
|
| 97 | + $this->assertContains('CRITICAL', $content); |
|
| 98 | + $this->assertContains('ERROR', $content); |
|
| 99 | 99 | } |
| 100 | 100 | } |
@@ -21,12 +21,12 @@ discard block |
||
| 21 | 21 | */ |
| 22 | 22 | protected function setUp() |
| 23 | 23 | { |
| 24 | - if( interface_exists( 'TYPO3\Flow\Cache\Frontend\FrontendInterface' ) === false ) { |
|
| 25 | - $this->markTestSkipped( 'Class \\TYPO3\\Flow\\Cache\\Frontend\\FrontendInterface not found' ); |
|
| 24 | + if (interface_exists('TYPO3\Flow\Cache\Frontend\FrontendInterface') === false) { |
|
| 25 | + $this->markTestSkipped('Class \\TYPO3\\Flow\\Cache\\Frontend\\FrontendInterface not found'); |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | - $this->mock = $this->getMock( 'TYPO3\Flow\Cache\Frontend\FrontendInterface' ); |
|
| 29 | - $this->object = new \Aimeos\MW\Cache\Flow( array(), $this->mock ); |
|
| 28 | + $this->mock = $this->getMock('TYPO3\Flow\Cache\Frontend\FrontendInterface'); |
|
| 29 | + $this->object = new \Aimeos\MW\Cache\Flow(array(), $this->mock); |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | |
@@ -38,190 +38,190 @@ discard block |
||
| 38 | 38 | */ |
| 39 | 39 | protected function tearDown() |
| 40 | 40 | { |
| 41 | - unset( $this->mock, $this->object ); |
|
| 41 | + unset($this->mock, $this->object); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | |
| 45 | 45 | public function testDelete() |
| 46 | 46 | { |
| 47 | - $this->mock->expects( $this->once() )->method( 'remove' )->with( $this->equalTo( 'key' ) ); |
|
| 48 | - $this->object->delete( 'key' ); |
|
| 47 | + $this->mock->expects($this->once())->method('remove')->with($this->equalTo('key')); |
|
| 48 | + $this->object->delete('key'); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | |
| 52 | 52 | public function testDeleteWithSiteId() |
| 53 | 53 | { |
| 54 | - $object = new \Aimeos\MW\Cache\Flow( array( 'siteid' => 1 ), $this->mock ); |
|
| 54 | + $object = new \Aimeos\MW\Cache\Flow(array('siteid' => 1), $this->mock); |
|
| 55 | 55 | |
| 56 | - $this->mock->expects( $this->once() )->method( 'remove' )->with( $this->equalTo( '1-key' ) ); |
|
| 57 | - $object->delete( 'key' ); |
|
| 56 | + $this->mock->expects($this->once())->method('remove')->with($this->equalTo('1-key')); |
|
| 57 | + $object->delete('key'); |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | |
| 61 | 61 | public function testDeleteList() |
| 62 | 62 | { |
| 63 | - $this->mock->expects( $this->exactly( 2 ) )->method( 'remove' )->with( $this->equalTo( 'key' ) ); |
|
| 64 | - $this->object->deleteList( array( 'key', 'key' ) ); |
|
| 63 | + $this->mock->expects($this->exactly(2))->method('remove')->with($this->equalTo('key')); |
|
| 64 | + $this->object->deleteList(array('key', 'key')); |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | |
| 68 | 68 | public function testDeleteListWithSiteId() |
| 69 | 69 | { |
| 70 | - $object = new \Aimeos\MW\Cache\Flow( array( 'siteid' => 1 ), $this->mock ); |
|
| 70 | + $object = new \Aimeos\MW\Cache\Flow(array('siteid' => 1), $this->mock); |
|
| 71 | 71 | |
| 72 | - $this->mock->expects( $this->once() )->method( 'remove' )->with( $this->equalTo( '1-key' ) ); |
|
| 73 | - $object->deleteList( array( 'key' ) ); |
|
| 72 | + $this->mock->expects($this->once())->method('remove')->with($this->equalTo('1-key')); |
|
| 73 | + $object->deleteList(array('key')); |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | |
| 77 | 77 | public function testDeleteByTags() |
| 78 | 78 | { |
| 79 | - $this->mock->expects( $this->exactly( 2 ) )->method( 'flushByTag' )->with( $this->equalTo( 'tag' ) ); |
|
| 80 | - $this->object->deleteByTags( array( 'tag', 'tag' ) ); |
|
| 79 | + $this->mock->expects($this->exactly(2))->method('flushByTag')->with($this->equalTo('tag')); |
|
| 80 | + $this->object->deleteByTags(array('tag', 'tag')); |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | |
| 84 | 84 | public function testDeleteByTagsWithSiteId() |
| 85 | 85 | { |
| 86 | - $object = new \Aimeos\MW\Cache\Flow( array( 'siteid' => 1 ), $this->mock ); |
|
| 86 | + $object = new \Aimeos\MW\Cache\Flow(array('siteid' => 1), $this->mock); |
|
| 87 | 87 | |
| 88 | - $this->mock->expects( $this->once() )->method( 'flushByTag' )->with( $this->equalTo( '1-tag' ) ); |
|
| 89 | - $object->deleteByTags( array( 'tag' ) ); |
|
| 88 | + $this->mock->expects($this->once())->method('flushByTag')->with($this->equalTo('1-tag')); |
|
| 89 | + $object->deleteByTags(array('tag')); |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | |
| 93 | 93 | public function testFlush() |
| 94 | 94 | { |
| 95 | - $this->mock->expects( $this->once() )->method( 'flush' ); |
|
| 95 | + $this->mock->expects($this->once())->method('flush'); |
|
| 96 | 96 | $this->object->flush(); |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | |
| 100 | 100 | public function testFlushWithSiteId() |
| 101 | 101 | { |
| 102 | - $object = new \Aimeos\MW\Cache\Flow( array( 'siteid' => 1 ), $this->mock ); |
|
| 102 | + $object = new \Aimeos\MW\Cache\Flow(array('siteid' => 1), $this->mock); |
|
| 103 | 103 | |
| 104 | - $this->mock->expects( $this->once() )->method( 'flushByTag' )->with( $this->equalTo( '1-siteid' ) ); |
|
| 104 | + $this->mock->expects($this->once())->method('flushByTag')->with($this->equalTo('1-siteid')); |
|
| 105 | 105 | $object->flush(); |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | |
| 109 | 109 | public function testGet() |
| 110 | 110 | { |
| 111 | - $this->mock->expects( $this->once() )->method( 'get' ) |
|
| 112 | - ->with( $this->equalTo( 'key' ) )->will( $this->returnValue( 'value' ) ); |
|
| 111 | + $this->mock->expects($this->once())->method('get') |
|
| 112 | + ->with($this->equalTo('key'))->will($this->returnValue('value')); |
|
| 113 | 113 | |
| 114 | - $this->assertEquals( 'value', $this->object->get( 'key', 'default' ) ); |
|
| 114 | + $this->assertEquals('value', $this->object->get('key', 'default')); |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | |
| 118 | 118 | public function testGetDefault() |
| 119 | 119 | { |
| 120 | - $this->mock->expects( $this->once() )->method( 'get' ) |
|
| 121 | - ->with( $this->equalTo( 'key' ) )->will( $this->returnValue( false ) ); |
|
| 120 | + $this->mock->expects($this->once())->method('get') |
|
| 121 | + ->with($this->equalTo('key'))->will($this->returnValue(false)); |
|
| 122 | 122 | |
| 123 | - $this->assertEquals( 'default', $this->object->get( 'key', 'default' ) ); |
|
| 123 | + $this->assertEquals('default', $this->object->get('key', 'default')); |
|
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | |
| 127 | 127 | public function testGetWithSiteId() |
| 128 | 128 | { |
| 129 | - $object = new \Aimeos\MW\Cache\Flow( array( 'siteid' => 1 ), $this->mock ); |
|
| 129 | + $object = new \Aimeos\MW\Cache\Flow(array('siteid' => 1), $this->mock); |
|
| 130 | 130 | |
| 131 | - $this->mock->expects( $this->once() )->method( 'get' )->with( $this->equalTo( '1-key' ) ); |
|
| 132 | - $object->get( 'key', 'default' ); |
|
| 131 | + $this->mock->expects($this->once())->method('get')->with($this->equalTo('1-key')); |
|
| 132 | + $object->get('key', 'default'); |
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | |
| 136 | 136 | public function testGetList() |
| 137 | 137 | { |
| 138 | - $this->mock->expects( $this->exactly( 2 ) )->method( 'get' ) |
|
| 139 | - ->will( $this->returnValue( 'value' ) ); |
|
| 138 | + $this->mock->expects($this->exactly(2))->method('get') |
|
| 139 | + ->will($this->returnValue('value')); |
|
| 140 | 140 | |
| 141 | - $expected = array( 'key1' => 'value', 'key2' => 'value' ); |
|
| 142 | - $this->assertEquals( $expected, $this->object->getList( array( 'key1', 'key2' ) ) ); |
|
| 141 | + $expected = array('key1' => 'value', 'key2' => 'value'); |
|
| 142 | + $this->assertEquals($expected, $this->object->getList(array('key1', 'key2'))); |
|
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | |
| 146 | 146 | public function testGetListWithSiteId() |
| 147 | 147 | { |
| 148 | - $object = new \Aimeos\MW\Cache\Flow( array( 'siteid' => 1 ), $this->mock ); |
|
| 148 | + $object = new \Aimeos\MW\Cache\Flow(array('siteid' => 1), $this->mock); |
|
| 149 | 149 | |
| 150 | - $this->mock->expects( $this->once() )->method( 'get' )->with( $this->equalTo( '1-key' ) ); |
|
| 151 | - $object->getList( array( 'key' ) ); |
|
| 150 | + $this->mock->expects($this->once())->method('get')->with($this->equalTo('1-key')); |
|
| 151 | + $object->getList(array('key')); |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | |
| 155 | 155 | public function testGetListByTags() |
| 156 | 156 | { |
| 157 | - $this->mock->expects( $this->exactly( 2 ) )->method( 'getByTag' ) |
|
| 158 | - ->with( $this->equalTo( 'key' ) )->will( $this->returnValue( array( 'key' => 'value' ) ) ); |
|
| 157 | + $this->mock->expects($this->exactly(2))->method('getByTag') |
|
| 158 | + ->with($this->equalTo('key'))->will($this->returnValue(array('key' => 'value'))); |
|
| 159 | 159 | |
| 160 | - $this->assertEquals( array( 'key' => 'value' ), $this->object->getListByTags( array( 'key', 'key' ) ) ); |
|
| 160 | + $this->assertEquals(array('key' => 'value'), $this->object->getListByTags(array('key', 'key'))); |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | |
| 164 | 164 | public function testGetListByTagsWithSiteId() |
| 165 | 165 | { |
| 166 | - $object = new \Aimeos\MW\Cache\Flow( array( 'siteid' => 1 ), $this->mock ); |
|
| 166 | + $object = new \Aimeos\MW\Cache\Flow(array('siteid' => 1), $this->mock); |
|
| 167 | 167 | |
| 168 | - $this->mock->expects( $this->once() )->method( 'getByTag' ) |
|
| 169 | - ->with( $this->equalTo( '1-key' ) )->will( $this->returnValue( array( '1-key' => 'value' ) ) ); |
|
| 168 | + $this->mock->expects($this->once())->method('getByTag') |
|
| 169 | + ->with($this->equalTo('1-key'))->will($this->returnValue(array('1-key' => 'value'))); |
|
| 170 | 170 | |
| 171 | - $this->assertEquals( array( 'key' => 'value' ), $object->getListByTags( array( 'key' ) ) ); |
|
| 171 | + $this->assertEquals(array('key' => 'value'), $object->getListByTags(array('key'))); |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | |
| 175 | 175 | public function testSet() |
| 176 | 176 | { |
| 177 | - $this->mock->expects( $this->once() )->method( 'set' ) |
|
| 177 | + $this->mock->expects($this->once())->method('set') |
|
| 178 | 178 | ->with( |
| 179 | - $this->equalTo( 'key' ), $this->equalTo( 'value' ), |
|
| 180 | - $this->equalTo( array( 'tag' ) ), $this->greaterThan( 0 ) |
|
| 179 | + $this->equalTo('key'), $this->equalTo('value'), |
|
| 180 | + $this->equalTo(array('tag')), $this->greaterThan(0) |
|
| 181 | 181 | ); |
| 182 | 182 | |
| 183 | - $this->object->set( 'key', 'value', array( 'tag' ), '2000-01-01 00:00:00' ); |
|
| 183 | + $this->object->set('key', 'value', array('tag'), '2000-01-01 00:00:00'); |
|
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | |
| 187 | 187 | public function testSetWithSiteId() |
| 188 | 188 | { |
| 189 | - $object = new \Aimeos\MW\Cache\Flow( array( 'siteid' => 1 ), $this->mock ); |
|
| 189 | + $object = new \Aimeos\MW\Cache\Flow(array('siteid' => 1), $this->mock); |
|
| 190 | 190 | |
| 191 | - $this->mock->expects( $this->once() )->method( 'set' ) |
|
| 191 | + $this->mock->expects($this->once())->method('set') |
|
| 192 | 192 | ->with( |
| 193 | - $this->equalTo( '1-key' ), $this->equalTo( 'value' ), |
|
| 194 | - $this->equalTo( array( '1-siteid', '1-tag' ) ), $this->equalTo( null ) |
|
| 193 | + $this->equalTo('1-key'), $this->equalTo('value'), |
|
| 194 | + $this->equalTo(array('1-siteid', '1-tag')), $this->equalTo(null) |
|
| 195 | 195 | ); |
| 196 | 196 | |
| 197 | - $object->set( 'key', 'value', array( 'tag' ), null ); |
|
| 197 | + $object->set('key', 'value', array('tag'), null); |
|
| 198 | 198 | } |
| 199 | 199 | |
| 200 | 200 | |
| 201 | 201 | public function testSetList() |
| 202 | 202 | { |
| 203 | - $this->mock->expects( $this->once() )->method( 'set' ) |
|
| 203 | + $this->mock->expects($this->once())->method('set') |
|
| 204 | 204 | ->with( |
| 205 | - $this->equalTo( 'key' ), $this->equalTo( 'value' ), |
|
| 206 | - $this->equalTo( array( 'tag' ) ), $this->greaterThan( 0 ) |
|
| 205 | + $this->equalTo('key'), $this->equalTo('value'), |
|
| 206 | + $this->equalTo(array('tag')), $this->greaterThan(0) |
|
| 207 | 207 | ); |
| 208 | 208 | |
| 209 | - $expires = array( 'key' => '2000-01-01 00:00:00' ); |
|
| 210 | - $this->object->setList( array( 'key' => 'value' ), array( 'key' => array( 'tag' ) ), $expires ); |
|
| 209 | + $expires = array('key' => '2000-01-01 00:00:00'); |
|
| 210 | + $this->object->setList(array('key' => 'value'), array('key' => array('tag')), $expires); |
|
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | |
| 214 | 214 | public function testSetListWithSiteId() |
| 215 | 215 | { |
| 216 | - $object = new \Aimeos\MW\Cache\Flow( array( 'siteid' => 1 ), $this->mock ); |
|
| 216 | + $object = new \Aimeos\MW\Cache\Flow(array('siteid' => 1), $this->mock); |
|
| 217 | 217 | |
| 218 | - $this->mock->expects( $this->once() )->method( 'set' ) |
|
| 218 | + $this->mock->expects($this->once())->method('set') |
|
| 219 | 219 | ->with( |
| 220 | - $this->equalTo( '1-key' ), $this->equalTo( 'value' ), |
|
| 221 | - $this->equalTo( array( '1-siteid', '1-tag' ) ), $this->equalTo( null ) |
|
| 220 | + $this->equalTo('1-key'), $this->equalTo('value'), |
|
| 221 | + $this->equalTo(array('1-siteid', '1-tag')), $this->equalTo(null) |
|
| 222 | 222 | ); |
| 223 | 223 | |
| 224 | - $object->setList( array( 'key' => 'value' ), array( 'key' => array( 'tag' ) ), array() ); |
|
| 224 | + $object->setList(array('key' => 'value'), array('key' => array('tag')), array()); |
|
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | } |
@@ -14,41 +14,41 @@ |
||
| 14 | 14 | |
| 15 | 15 | protected function setUp() |
| 16 | 16 | { |
| 17 | - if( !class_exists( '\TYPO3\Flow\Http\Request' ) ) { |
|
| 18 | - $this->markTestSkipped( '\TYPO3\Flow\Http\Request is not available' ); |
|
| 17 | + if (!class_exists('\TYPO3\Flow\Http\Request')) { |
|
| 18 | + $this->markTestSkipped('\TYPO3\Flow\Http\Request is not available'); |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | - if( !class_exists( '\Zend\Diactoros\ServerRequestFactory' ) ) { |
|
| 22 | - $this->markTestSkipped( '\Zend\Diactoros\ServerRequestFactory is not available' ); |
|
| 21 | + if (!class_exists('\Zend\Diactoros\ServerRequestFactory')) { |
|
| 22 | + $this->markTestSkipped('\Zend\Diactoros\ServerRequestFactory is not available'); |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | $view = new \Aimeos\MW\View\Standard(); |
| 26 | - $server = array( 'REMOTE_ADDR' => '127.0.0.1' ); |
|
| 27 | - $request = new \TYPO3\Flow\Http\Request( array(), array(), array(), $server ); |
|
| 28 | - $this->object = new \Aimeos\MW\View\Helper\Request\Flow( $view, $request, array(), array(), array(), array(), $server ); |
|
| 26 | + $server = array('REMOTE_ADDR' => '127.0.0.1'); |
|
| 27 | + $request = new \TYPO3\Flow\Http\Request(array(), array(), array(), $server); |
|
| 28 | + $this->object = new \Aimeos\MW\View\Helper\Request\Flow($view, $request, array(), array(), array(), array(), $server); |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | |
| 32 | 32 | protected function tearDown() |
| 33 | 33 | { |
| 34 | - unset( $this->object, $this->mock ); |
|
| 34 | + unset($this->object, $this->mock); |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | |
| 38 | 38 | public function testTransform() |
| 39 | 39 | { |
| 40 | - $this->assertInstanceOf( '\Aimeos\MW\View\Helper\Request\Flow', $this->object->transform() ); |
|
| 40 | + $this->assertInstanceOf('\Aimeos\MW\View\Helper\Request\Flow', $this->object->transform()); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | |
| 44 | 44 | public function testGetClientAddress() |
| 45 | 45 | { |
| 46 | - $this->assertEquals( '127.0.0.1', $this->object->getClientAddress() ); |
|
| 46 | + $this->assertEquals('127.0.0.1', $this->object->getClientAddress()); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | |
| 50 | 50 | public function testGetTarget() |
| 51 | 51 | { |
| 52 | - $this->assertEquals( null, $this->object->getTarget() ); |
|
| 52 | + $this->assertEquals(null, $this->object->getTarget()); |
|
| 53 | 53 | } |
| 54 | 54 | } |
@@ -16,23 +16,23 @@ |
||
| 16 | 16 | |
| 17 | 17 | protected function setUp() |
| 18 | 18 | { |
| 19 | - if( !class_exists( '\Zend\Diactoros\Response' ) ) { |
|
| 20 | - $this->markTestSkipped( '\Zend\Diactoros\Response is not available' ); |
|
| 19 | + if (!class_exists('\Zend\Diactoros\Response')) { |
|
| 20 | + $this->markTestSkipped('\Zend\Diactoros\Response is not available'); |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | $view = new \Aimeos\MW\View\Standard(); |
| 24 | - $this->object = new \Aimeos\MW\View\Helper\Response\Flow( $view ); |
|
| 24 | + $this->object = new \Aimeos\MW\View\Helper\Response\Flow($view); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | |
| 28 | 28 | protected function tearDown() |
| 29 | 29 | { |
| 30 | - unset( $this->object ); |
|
| 30 | + unset($this->object); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | |
| 34 | 34 | public function testTransform() |
| 35 | 35 | { |
| 36 | - $this->assertInstanceOf( '\Aimeos\MW\View\Helper\Response\Flow', $this->object->transform() ); |
|
| 36 | + $this->assertInstanceOf('\Aimeos\MW\View\Helper\Response\Flow', $this->object->transform()); |
|
| 37 | 37 | } |
| 38 | 38 | } |