simpletest

Python code question 5

℡╲_俬逩灬. 提交于 2021-01-10 20:05:38
Question: Define a class which has at least two methods: getString: to get a string from console input printString: to print the string in upper case. Also please include simple test function to test the class methods. Hints: Use init method to construct some parameters #!/usr/bin/env python # -*- coding:utf-8 -*- #@Time : 2021/1/10 18:34 #@Author: developer #@File : q5.py ''' Question: Define a class which has at least two methods: getString: to get a string from console input printString: to print the string in upper case. Also please include simple test function to test the class methods.

BeetlSQL 3.0.10 发布,多数据源分布式sega事务支持

雨燕双飞 提交于 2020-11-12 10:59:24
本次发布主要增加了分布式Sega事务支持,适合多数据源 按照社区建议,修改了了springboot 的 yml配置方式 修改了@Jackson和@UpdateTime,本来是用来作为例子,但社区开发者提供了较好的完整实现 增加Sega支持 <dependency> <groupId>com.ibeetl</groupId> <artifactId>beetlsql</artifactId> <version>3.0.10-RELEASE</version> </dependency> public class UserEntity{ @Jackson Map<String,Address> addresses; @UpdateTime LocalDateTime updateTime; } 在多库多数据源的场景下,ORM工具有三个挑战,一个是如何根据各种策略分库分表,一个是如何方便的查询多库的数据,另外一个是多库操作的事务 BeetlSQL能很好的支持分库分表策略,以及提供了简单的Sega事务支持。至于多库查询,则可以交给第三方SQL查询引擎,BeetlSQL也支持多种SQL查询引擎,比如Druid,PrestoSQL public interface UserMapper extends SegaMapper<User> { @SegaUpdateSql( sql="update

Unit Testing With SimpleTest in PHP keeping getting file directory errors from relative paths?

删除回忆录丶 提交于 2020-01-16 08:45:48
问题 I am using Zend Framework MVC and unit-testing with SimpleTest library. I have a specific model that keeps failing because it uses Zend Cache and the cache directory is a relative path I was wondering if anyone has seen a problem like this b4. Thanks. 回答1: I had to make an absolute path using $_SERVER['DOCUMENT_ROOT'] that way no matter what file structure I am on it works. a Truly relative path. lol. 来源: https://stackoverflow.com/questions/1463557/unit-testing-with-simpletest-in-php-keeping

How can I write tests for file upload in PHP?

耗尽温柔 提交于 2019-12-29 05:07:48
问题 I'm using simpleTest to write my PHP tests. I'm writing a file upload plugin and was wondering how I may be testing it. I would like to check that the file is correctly uploaded, in the right folder, that error are correctly returned when needed, etc. How do I emulate a file upload (through the $_FILES variable) ? Are there any issues I should be aware of ? 回答1: I've found an alternate solution. I've spoofed the $_FILES array with test data, created dummy test files in the tmp/ folder (the

SimpleTest with CodeIgniter — won't identify file — variables die?

好久不见. 提交于 2019-12-25 04:56:15
问题 I am trying to use SimpleTest with CodeIgniter, using code supplied by maroonbytes. I am using LAMP and NetBeans 6.9. The test.php page loads up in my browser. I have a stub test in place and it shows in the drop-down selections. When I try to run it, I get 2 PHP errors: Message: include_once(/var/www/sparts3/main/tests/basic_test_v.php): failed to open stream: No such file or directory Message: include_once(): Failed opening '/var/www/sparts3/main/tests/basic_test_v.php' for inclusion

Strange thing using simple test in Php

ε祈祈猫儿з 提交于 2019-12-24 20:27:38
问题 file1: <?php require_once('simpletest/autorun.php'); require_once('simpletest/web_tester.php'); class TestOfRankings extends WebTestCase { function tesetWeAreTopOfGoogle() { $this->get('http://poll:8888/index.php/admin/unit_test'); $this->assertText('this is good'); } } ?> file2: require_once('simpletest/autorun.php'); require_once('simpletest/web_tester.php'); class MakTest extends WebTestCase { function testOneAndOneMakesTwo() { $this->get('http://poll:8888/index.php/admin/unit_test');

how can I test view where authentication is required, with cakePHP and SimpleTest

大憨熊 提交于 2019-12-23 05:22:28
问题 I'd like to write WebTestCase of views that requires authentification. Is it possible? How can I pass authentification? I tried with writing basic authentification in the session but it doesn't work. $_SESSION['Auth']['User']['id'] = 1; $_SESSION['Auth']['User']['username'] = 'nico'; 回答1: function login() { $this->get($this->host_name."/users/login/"); $this->assertText("Login"); $this->setField("data[User][username]",'xxxx'); $this->setField("data[User][password]",'xxxx'); $this-

Why should I be using testing frameworks in PHP?

百般思念 提交于 2019-12-21 22:08:40
问题 I have recently heard a lot of people argue about using PHP testing features like PHPunit and SimpleTest together with their IDE of choice (Eclipse for me). After googling the subject, I have still a hard time understanding the pros and cons of using these testing frameworks to speed up development. If anyone could explain this for me in a more basic level, I would really appreciate it. I am using PHP5 for the notice. Thanks a lot! 回答1: I'm not a big fan of unit testing: I'm not saying they

Equivalent of SimpleTest “partial mocks” in PHPUnit?

独自空忆成欢 提交于 2019-12-21 03:12:09
问题 I'm trying to migrate a bunch of tests from SimpleTest to PHPUnit and I was wondering if there is an equivalent for SimpleTest's partial mocks. Update: I can't seem to find anything in the docs which suggests that this feature is available, but it occurred to me that I could just use a subclass. Is this a good or bad idea? class StuffDoer { protected function doesLongRunningThing() { sleep(10); return "stuff"; } public function doStuff() { return $this->doesLongRunningThing(); } } class

How do I write unit tests in PHP with a procedural codebase?

久未见 提交于 2019-12-20 08:03:51
问题 I'm mostly convinced of the benefits of unit testing, and I would like to start applying the concept to a large existing codebase written in PHP. Less than 10% of this code is object-oriented. I've looked at several unit testing frameworks (PHPUnit, SimpleTest, and phpt). However, I haven't found examples for any of these that test procedural code. What's the best framework for my situation and are there any examples of unit testing PHP using non-OOP code? 回答1: You can unit-test procedural