zend-framework

How to decouple my data layer better and restrict the scope of my unit tests?

送分小仙女□ 提交于 2019-12-23 18:21:22
问题 I'm getting to grips with unit testing and learning how to break up my code into testable bits, but one thing I'm not clear on is how I can write my 'higher-level' code, such as my controller actions, so that testing the controller doesn't require going through the actual data layer (which is independently tested elsewhere in my test suite). For example - I have a user validation which takes a username/password and validates their account and returns login success/failure: class Api

When cleaning magento cache Opening and ending tag mismatch: /Varien/Simplexml/Config.php

你说的曾经没有我的故事 提交于 2019-12-23 18:19:45
问题 Entity: line 60: parser error : Opening and ending tag mismatch: config line 28 and confg in /home/theprint/public_html/lib/Varien/Simplexml/Config.php This exception happens when I try to clean the magento cache and I have enabled to print errors on my index.php, if I dont have this line on index.php, then it works fine if ($_SERVER['REMOTE_ADDR'] == '83.134.115.xxx') { Mage::setIsDeveloperMode(true); ini_set('display_errors', 1); } Warning: simplexml_load_string() [function.simplexml-load

How do I stop warnings in phpDocumentor parser when I inherit from an external library class?

a 夏天 提交于 2019-12-23 18:03:15
问题 I've been adding docblocks to my code, and have resolved most of the build errors and warnings that the phpDocumentor script has generated and placed into the errors.html file. However, I have one last 'class' of warnings in my current documentation build - I get a warning for every class that I have documented in my application that inherits from an external library (in this case, Zend). Is there a way to stop warnings such as Warning - Class AMH_Controller_Action parent Zend_Controller

Zend_Form_Element_MultiCheckbox: How to display a long list of checkboxes as columns?

☆樱花仙子☆ 提交于 2019-12-23 17:34:48
问题 So I am using a Zend_Form_Element_MultiCheckbox to display a long list of checkboxes. If I simply echo the element, I get lots of checkboxes separated by <br /> tags. I would like to figure out a way to utilize the simplicity of the Zend_Form_Element_MultiCheckbox but also display as multiple columns (i.e. 10 checkboxes in a <div style="float:left"> ). I can do it manually if I had an array of single checkbox elements, but it isn't the cleanest solution: <?php if (count($checkboxes) > 5) {

(PHP): Testing models with Zend_Test_PHPUnit_DatabaseTestCase

雨燕双飞 提交于 2019-12-23 17:33:44
问题 When I run my PHP unit test I get: 1) Test_Model_Mapper_TestTest::testTest Argument 1 passed to PHPUnit_Extensions_Database_DataSet_DefaultTableIterator::__construct() must be an array, null given, called in /usr/share/php/PHPUnit/Extensions/Database/DataSet/AbstractXmlDataSet.php on line 134 and defined /var/www/kosheroven/library/Zend/Test/PHPUnit/Db/Operation/Truncate.php:73 /var/www/kosheroven/tests/ModelTestCase.php:79 /var/www/kosheroven/tests/application/models/mappers/TestTest.php:33

How to make parameter optional in Zend Framework Router

天大地大妈咪最大 提交于 2019-12-23 17:17:18
问题 I would like to know the .ini config file setup to make a route wherein the page number parameter is optional so that http://news.mysite.com/national http://news.mysite.com/national/1 point to the same page. I have the code as follows resources.router.routes.news_list.type = "Zend_Controller_Router_Route_Regex" resources.router.routes.news_list.route = "([a-zA-Z0-9\-]+)/([0-9\-]+)" resources.router.routes.news_list.defaults.module = "news" resources.router.routes.news_list.defaults.controller

Zend Framework PDF problems

眉间皱痕 提交于 2019-12-23 17:14:26
问题 It's me again guys, I have a small problem: // Create new PDF $pdf = new Zend_Pdf(); // Add new page to the document $page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4); $pdf->pages[] = $page; // Set font $page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 20); // Draw text $page->drawText('Hello world!', 100, 510); $this->getResponse() ->setHeader('Content-Disposition', 'attachment; filename=result.pdf') ->setHeader('Content-type', 'application/x-pdf'); echo $pdf->render();

Custom HTML Output on Zend Form Checkbox setLabel Property

那年仲夏 提交于 2019-12-23 17:00:51
问题 I am rendering a Zend Form Checkbox and I would like to render some custom html at its setlabel property. My form construct model $terms = new Zend_Form_Element_Checkbox('confirm_terms'); In my View Script $this->form->confirm_terms->setLabel('<a href="'.'/index/terms'.'">Terms of Service</a>'); However since setLabel escapes the output it rendered as it is. Any creative ways of rendering the setlabel property as CustomHTML? 回答1: You need to disable the auto-escaping of the label, following

How do I successfully create a project with Zend Framework and PHPUnit?

浪子不回头ぞ 提交于 2019-12-23 17:00:47
问题 Let me just start by saying that I've posted this to multiple forums and even tried to get help on the ZF IRC channel. I've been Googling for a straight week and still no results. I've read a lot of Q's and A's on this site in the past, so I figured I'd make an account and try asking you. (Yes, I've searched previously asked questions, but none of the answers helped me.) I'm trying to learn how to use Zend Framework for a new project that I've joined. For compatibility reasons they are using

Zend reverse matching of routes returns current URL

徘徊边缘 提交于 2019-12-23 16:56:02
问题 I'm using Zend Framework, and am trying to set up some custom routes. These seem to be working fine during dispatch, but the reverse matching isn't working at all. These are the routes I've set up. $router->addRoute('category', new Zend_Controller_Router_Route( 'categories/:category', array( 'controller' => 'category', 'action' => 'modify', ) )); $router->addRoute('categories', new Zend_Controller_Router_Route_Static( 'categories', array( 'controller' => 'category', 'action' => 'index' ) ));