Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Commit

Permalink
Various fixes in various components that facilitate a working MVC app…
Browse files Browse the repository at this point in the history
…lication

Zend\Controller & Zend\Application now only run namespaced applications
Zend\Controller now assumes default module is 'application' (Default is a reserved word)
Zend\Log priority casting fix
Zend\Db\Table fix for row type class check
ZendTest\Filter\StripTagsTest fixed for duplicated test
  • Loading branch information
Ralph Schindler committed Aug 2, 2010
1 parent b4e4ced commit 47f41ed
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 16 deletions.
8 changes: 6 additions & 2 deletions src/Filter/Priority.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class Priority extends AbstractFilter
* @param string $operator Comparison operator
* @throws \Zend\Log\Exception
*/
public function __construct($priority, $operator = \NULL)
public function __construct($priority, $operator = null)
{
if (! is_integer($priority)) {
throw new \Zend\Log\Exception('Priority must be an integer');
Expand Down Expand Up @@ -85,8 +85,12 @@ static public function factory($config = array())
$config['priority'] = constant($config['priority']);
}

if (!is_numeric($config['priority'])) {
throw new \Zend\Log\Exception('Priority must be an integer.');
}

return new self(
$config['priority'],
(int) $config['priority'],
$config['operator']
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Writer/Db.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ static public function factory($config = array())
/**
* Formatting is not possible on this writer
*/
public function setFormatter(Zend_Log_Formatter_Interface $formatter)
public function setFormatter(\Zend\Log\Formatter $formatter)
{
throw new Log\Exception(get_class() . ' does not support formatting');
}
Expand Down
4 changes: 2 additions & 2 deletions test/Filter/PriorityTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function testFactory()
'writerName' => "Mock",
'filterName' => "Priority",
'filterParams' => array(
'priority' => "\\Zend\\Log\\Logger::CRIT",
'priority' => '\Zend\Log\Logger::CRIT',
'operator' => "<="
),
)));
Expand All @@ -78,7 +78,7 @@ public function testFactory()

public function testFactoryRaisesExceptionWithInvalidPriority()
{
$this->setExpectedException('\\Zend\\Log\\Exception', 'must be an integer');
$this->setExpectedException('\Zend\Log\Exception', 'must be an integer');
$logger = Logger::factory(array('Null' => array(
'writerName' => 'Mock',
'filterName' => 'Priority',
Expand Down
13 changes: 7 additions & 6 deletions test/Writer/DbTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,13 @@ public function testFactory()
*/
public function testThrowStrictSetFormatter()
{
try {
$this->writer->setFormatter(new StdClass());
} catch (Exception $e) {
$this->assertType('PHPUnit_Framework_Error', $e);
$this->assertContains('must implement interface', $e->getMessage());
}
$this->setExpectedException('PHPUnit_Framework_Error');
// try {
$this->writer->setFormatter(new \StdClass());
// } catch (Exception $e) {
// $this->assertType('PHPUnit_Framework_Error', $e);
// $this->assertContains('must implement interface', $e->getMessage());
// }
}
}

Expand Down
12 changes: 7 additions & 5 deletions test/Writer/ZendMonitorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
* @version $Id$
*/

namespace ZendTest\Log\Writer;

/** PHPUnit_Framework_TestCase */
require_once 'PHPUnit/Framework/TestCase.php';

Expand All @@ -34,28 +36,28 @@
* @license http://framework.zend.com/license/new-bsd New BSD License
* @group Zend_Log
*/
class Zend_Log_Writer_ZendMonitorTest extends PHPUnit_Framework_TestCase
class ZendMonitorTest extends \PHPUnit_Framework_TestCase
{
/**
* @group ZF-10081
*/
public function testWrite()
{
$writer = new Zend_Log_Writer_ZendMonitor();
$writer = new \Zend\Log\Writer\ZendMonitor();
$writer->write(array('message' => 'my mess', 'priority' => 1));
}

public function testFactory()
{
$cfg = array();

$writer = Zend_Log_Writer_ZendMonitor::factory($cfg);
$this->assertTrue($writer instanceof Zend_Log_Writer_ZendMonitor);
$writer = \Zend\Log\Writer\ZendMonitor::factory($cfg);
$this->assertTrue($writer instanceof \Zend\Log\Writer\ZendMonitor);
}

public function testIsEnabled()
{
$writer = new Zend_Log_Writer_ZendMonitor();
$writer = new \Zend\Log\Writer\ZendMonitor();
$this->assertType('boolean', $writer->isEnabled());
}
}

0 comments on commit 47f41ed

Please sign in to comment.