phpspec

phpspec and laravel setup

跟風遠走 提交于 2021-02-17 20:55:17
问题 I am setting up a new Laravel project and integrating PHPSpec. I am having trouble finding a good working example of the phpspec.yml file that would work neatly with Laravel. In a similar way to RSpec in Rails. My desired folder structure would be as follows spec/ models/ controllers/ app/ models/ controllers/ My phpspec.yml currently looks like this: suites: controller_suite: namespace: Controller spec_path: 'spec/controllers' src_path: 'app/controllers' model_suite: namespace: Model spec

How do I call Validator from a namespace with an already existing Validator class

≡放荡痞女 提交于 2020-02-06 05:31:46
问题 I'm trying to test a function in phpspec which calls Laravel's Validator::make function (http://laravel.com/docs/4.2/validation) However, I'm trying to call that same function from a namespace where the Validator class name is already taken. How can I call that function described in the docs? Failed solutions: Attempt 1 return \Illuminate\Validation\Validator::make($values,$rules); gives me Call to undefined method Illuminate\Validation\Validator::make() Attempt 2 return \Illuminate

How do I call Validator from a namespace with an already existing Validator class

自古美人都是妖i 提交于 2020-02-06 05:31:07
问题 I'm trying to test a function in phpspec which calls Laravel's Validator::make function (http://laravel.com/docs/4.2/validation) However, I'm trying to call that same function from a namespace where the Validator class name is already taken. How can I call that function described in the docs? Failed solutions: Attempt 1 return \Illuminate\Validation\Validator::make($values,$rules); gives me Call to undefined method Illuminate\Validation\Validator::make() Attempt 2 return \Illuminate

How do I call Validator from a namespace with an already existing Validator class

北慕城南 提交于 2020-02-06 05:31:05
问题 I'm trying to test a function in phpspec which calls Laravel's Validator::make function (http://laravel.com/docs/4.2/validation) However, I'm trying to call that same function from a namespace where the Validator class name is already taken. How can I call that function described in the docs? Failed solutions: Attempt 1 return \Illuminate\Validation\Validator::make($values,$rules); gives me Call to undefined method Illuminate\Validation\Validator::make() Attempt 2 return \Illuminate

Phpspec No calls have been made that match

时光怂恿深爱的人放手 提交于 2020-01-07 04:13:05
问题 I'm struggling with phpspec and No calls have been made that match while the call was actually made. Here is the code so far: function it_imports_social_feeds( ContainerInterface $container, FacebookManagerFactory $managerFactory, FacebookConnector $facebookConnector, FacebookMapper $facebookMapper, EzContent $ezContent, Collection $feed, Content $content ) { $chainProfiles = []; $container->getParameter('someParam1')->willReturn($chainProfiles); $container->get('someParam2') ->shouldBeCalled

Integrating Codeigniter 2 with phpspec2

江枫思渺然 提交于 2019-12-23 03:14:11
问题 I want to integrate phpspec2 with CodeIgniter 2. I've succesfully installed phpspec using composer as described on phpspec website. Now I'd like to integrate it into my CodeIgniter 2 installation. I've found an article by AniDear on this subject and did everything as described. However when I run bin/phpspec I get an error: PHP Warning: require(core/Common.php): failed to open stream: No such file or directory in C:\xampp\htdocs\eljotengine\spec\ci_bootstrap.php on line 37 Warning: require

First Shot at Testing Laravel 4 apps (PHPSpec/BDD vs. PHPUnit/TDD)

戏子无情 提交于 2019-12-20 09:56:18
问题 I have been wrestling with this question for far too long now. I know I need to just jump into one or the other since they are both obviously viable/useful tools, but have been stuck on the fence, researching both, for weeks. PHPUnit vs. PHPSpec - Which one may lead to better long-term maintainability and programming practices? I have talked to several seasoned PHPUnit -> PHPspec converts/users who now swear by PHPspec, claiming that it promotes better design thanks to its BDD approach.

PHPSpec and Laravel - how to handle double method not found issues

岁酱吖の 提交于 2019-12-13 05:59:06
问题 I appear to be having issues with my spec tests when it comes to stubs that are calling other methods. I've been following Laracasts 'hexagonal' approach for my controller to ensure it is only responsible for the HTTP layer. Controller <?php use Apes\Utilities\Connect; use \OAuth; class FacebookConnectController extends \BaseController { /** * @var $connect */ protected $connect; /** * Instantiates $connect * * @param $connect */ function __construct() { $this->connect = new Connect($this,

Testing factory method in command handler with phpspec

Deadly 提交于 2019-12-10 11:44:40
问题 How to test static methods which are infact factory methods: public function hireEmployee(HireEmployeeCommand $command) { $username = new EmployeeUsername($command->getUsername()); $firstName = $command->getFirstName(); $lastName = $command->getLastName(); $phoneNumber = new PhoneNumber($command->getPhoneNumber()); $email = new Email($command->getEmail()); $role = new EmployeeRole($command->getRole()); if ($role->isAdmin()) { $employee = Employee::hireAdmin($username, $firstName, $lastName,

PHPSpec Catching TypeError in PHP7

会有一股神秘感。 提交于 2019-12-10 03:21:24
问题 I want test an example method with scalar type hinting and strict types in PHP7. When I don't pass an argument, the method should throw a TypeError . PHPSpec return fatal error: Uncaught TypeError: Argument 1 passed to Example::test <?php class Example { public function test(string $name) { $this->name = $name; } } class ExampleSpec extends ObjectBehavior { function it_is_initializable() { $this->shouldHaveType('Test\Example'); } function it_check_test_method_when_not_pass_argument() { $this-