mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 11:06:15 +00:00
adding NumberHelperTest
This commit is contained in:
parent
cd7a8452a2
commit
ef73fff6be
1 changed files with 79 additions and 0 deletions
79
lib/Cake/Test/Case/View/Helper/NumberHelperTest.php
Normal file
79
lib/Cake/Test/Case/View/Helper/NumberHelperTest.php
Normal file
|
@ -0,0 +1,79 @@
|
|||
<?php
|
||||
/**
|
||||
* NumberHelperTest file
|
||||
*
|
||||
* PHP 5
|
||||
*
|
||||
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||
* Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* Redistributions of files must retain the above copyright notice
|
||||
*
|
||||
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||
* @package Cake.Test.Case.View.Helper
|
||||
* @since CakePHP(tm) v 1.2.0.4206
|
||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
|
||||
App::uses('View', 'View');
|
||||
App::uses('NumberHelper', 'View/Helper');
|
||||
|
||||
/**
|
||||
* NumberHelperTestObject class
|
||||
*/
|
||||
class NumberHelperTestObject extends NumberHelper {
|
||||
|
||||
public function attach(CakeNumber $cakeNumber) {
|
||||
$this->_CakeNumber = $cakeNumber;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* NumberHelperTest class
|
||||
*
|
||||
* @package Cake.Test.Case.View.Helper
|
||||
*/
|
||||
class NumberHelperTest extends CakeTestCase {
|
||||
|
||||
/**
|
||||
* setUp method
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setUp() {
|
||||
parent::setUp();
|
||||
$view = $this->getMock('View', array(), array(), '', false);
|
||||
$this->CakeNumber = $this->getMock('CakeNumber');
|
||||
$this->Number = new NumberHelperTestObject($view);
|
||||
$this->Number->attach($this->CakeNumber);
|
||||
}
|
||||
|
||||
/**
|
||||
* tearDown method
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function tearDown() {
|
||||
parent::tearDown();
|
||||
unset($this->Number);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* test CakeNumber class methods are called correctly
|
||||
*/
|
||||
public function testNumberHelperProxyMethodCalls() {
|
||||
$methods = array(
|
||||
'precision', 'toReadableSize', 'toPercentage', 'format',
|
||||
'currency', 'addFormat',
|
||||
);
|
||||
foreach ($methods as $method) {
|
||||
$this->CakeNumber->expects($this->at(0))->method($method);
|
||||
$this->Number->{$method}('who', 'what', 'when', 'where', 'how');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Reference in a new issue