GitHub
Tests: 12 • Commercial: 2 • Pet projects: 4 • Legacy: 4
Total: 22

.NET Framework

Test
2021

Project Request

ASP.NET MVC • C# • SQL Server
Idea of the project: if someone wants to order a project development, here you can send an application.
Test
2020

ProjectC

ASP.NET MVC • C# • JSON • jQuery
JSON data processing.
Test
2020

Vehicle Maintenance

ASP.NET MVC • VB.NET • JSON
Idea of the project: if someone wants to order a project development, here you can send an application.
Test
2019

Movie Navigator

ASP.NET MVC • VB.NET
Request information about movie from IMDB.
Test
2018

Customers Exchange

ASP.NET MVC • C# • SQL Server
Automated teller machine emulation.
Test
2016

ATM

ASP.NET MVC • C#
Automated teller machine emulation.

.NET Core

Pet project
2022

Mail Daemon

.NET 8 • Console • JSON
Utility to send mails with customizable settings.

Custom

Code
2024

Buns of code

.NET Framework • C# • JavaScript
Code snippets from my projects, ready to use; tiny tests; code examples.

PHP

Test
2024

Mediabox

PHP 8 • Laravel 11 • Vue.js • Composer • SQLite
Test project for media files management.
Test
2020

Loan Castle

PHP • MariaDB
Jums jāizstrādā kāda lielāk projekta prototips. Izstrādājot prototipu, paturiet prātā, ka projektam attīstoties, šo prototipu varētu vajadzēt pilnveidot.
Test
2020

Content Management

PHP • MySQL • AJAX
Создать простой сайт, где будет страница с формой для авторизации и страница для авторизованного пользователя.
Test
2019

Laravel

PHP • Laravel • Vue.js • Composer • SQLite
Izveidot aplikāciju, kura ik pēc noteikta intervāla (60 sekundes) veic ierakstu datubāzē izmantojot Laravel freimworka iebūvēto funkcionalitāti.
Test
2019

Phone Check

PHP • JavaScript • JSON • Docker
Implement application to detect country by phone number.

Frontend

Test
2021

Forex Wall

npm • React
For this exercise, what we need is a simple live wall for tracking currencies.

Business projects

Commercial
2008

Certification Center

.NET Framework 4.8 • ASP.NET Web Forms • C# • LINQ • SQL Server • ADO.NET • Dapper • JavaScript • jQuery • Git
Transport registration and certification services in Latvia, Customer Relationship Management.
Commercial
2000

Amerikas Auto

.NET Framework 4.8 • ASP.NET Web Forms • C# • LINQ • SQL Server • ADO.NET • Entity Framework • JavaScript • jQuery • Git
Car service and spare parts for all USA and European car models, Customer Relationship Management.

Pet projects

Pet project
2023

Geolocation Assistant

.NET 8 • ASP.NET Core • C# • Web API • JSON • Git
Website for determining geolocation by IP or geotagged photo.
Pet project
2008

Web Dynamics

.NET Framework 4.8 • ASP.NET Web Forms • C# • LINQ • Web API • JSON • SQL Server • Dapper • JavaScript • jQuery • SVG • Git
Software development blog. Articles, books, videos, content management.
Pet project
2000

Blackball

.NET Framework 4.8 • ASP.NET Web Forms • C# • LINQ • Web API • JSON • XML • SQL Server • Dapper • JavaScript • jQuery • SVG • Git
My entertainment portal created from scratch.

Good old times

Legacy
2000

DOS Clock

Turbo Pascal • Assembler
Digital clock.
Legacy
2000

BrainOut

Turbo Pascal • Assembler
Tank battle game.
Legacy
1999

Airport Administrator

Turbo Pascal
Курсовая работа в институте.
Legacy
1998

Atomizer

Turbo Pascal • Assembler
Atomizer, aka «Studio2D». Graphic raster editor. AGI is my own «Atomizer Generated Image» file format.

Laravel

2019 Test

Izveidot aplikāciju, kura ik pēc noteikta intervāla (60 sekundes) veic ierakstu datubāzē izmantojot Laravel freimworka iebūvēto funkcionalitāti.

PHP Laravel Vue.js Composer SQLite
Information
Source code
  app
  Http
  Auth
  css
  js
  js
  lang
  en
  sass
  app
  data
  logs
  Unit
  src
  src
  lib
  docs
  en
  src
  docs
  en
  lib
  src
  Cron
  Cron
  src
  filp
  src
  css
  js
  Util
  src
  ORM
  Spot
  test
  Core
  Text
  Type
  Xml
  Core
  Text
  Type
  Xml
  html
  src
  src
  src
  Auth
  make
  auth
  Bus
  Auth
  Bus
  Http
  Mail
  View
  Auth
  Bus
  Http
  Http
  Json
  Log
  Mail
  html
  text
  Jobs
  View
  src
  src
  Util
  docs
  Pass
  Pass
  Pass
  doc
  src
  Curl
  doc
  f001
  f002
  f003
  f004
  f005
  f006
  f007
  f008
  src
  Date
  Spl
  src
  Lang
  List
  doc
  lib
  Node
  Expr
  Cast
  Name
  Stmt
  test
  code
  expr
  uvs
  stmt
  loop
  expr
  stmt
  Node
  Stmt
  src
  opis
  src
  dist
  lib
  src
  xml
  xml
  src
  Unit
  src
  src
  Tags
  src
  src
  src
  Call
  Node
  Call
  Util
  src
  Node
  Html
  css
  js
  Xml
  HTML
  XML
  src
  src
  src
  src
  src
  Stub
  Hook
  Util
  Log
  PHP
  cli
  1149
  1216
  1265
  1330
  1335
  1337
  1348
  1351
  1374
  1437
  1468
  1471
  1472
  1570
  2085
  2137
  2145
  2158
  2366
  2380
  2382
  2435
  244
  2448
  2724
  2725
  2731
  2811
  2830
  2972
  3093
  3107
  3156
  322
  3364
  3379
  3380
  3396
  433
  445
  498
  503
  581
  74
  765
  797
  873
  Trac
  1021
  523
  578
  684
  783
  fail
  unit
  Util
  PHP
  psr
  src
  log
  Psr
  Log
  Test
  src
  psy
  src
  Sudo
  Util
  test
  Sudo
  Util
  box
  uuid
  src
  Time
  Node
  Time
  src
  src
  diff
  src
  out
  src
  src
  src
  src
  src
  src
  src
  src
  doc
  lib
  Mime
  Pop
  Auth
  Mime
  bug
  unit
  Mime
  Auth
  dkim
  Node
  Node
  psr4
  phpt
  .dot
  b
  a
  A
  B
  C
  copy
  A
  B
  C
  one
  b
  .dot
  a
  dir
  File
  Test
  File
  test
  Test
  Log
  Log
  mime
  Part
  test
  Part
  glob
  Test
  data
  dat
  res
  Util
  Util
  Test
  css
  js
  Test
  Test
  src
  src
  Css
  Rule
  src
  src
  .env
  null
Root / vendor / mockery / mockery
Name
Size
Date created
Date modified
27.07.2024 15:14
27.07.2024 15:14
27.07.2024 15:14
27.07.2024 15:14
27.07.2024 15:14
27.07.2024 15:14
27.07.2024 15:14
27.07.2024 15:14
201 bytes
03.07.2019 02:18
03.07.2019 02:18
287 bytes
03.07.2019 02:18
03.07.2019 02:18
582 bytes
03.07.2019 02:18
03.07.2019 02:18
676 bytes
03.07.2019 02:18
03.07.2019 02:18
158 bytes
03.07.2019 02:18
03.07.2019 02:18
2 KB
03.07.2019 02:18
03.07.2019 02:18
5 KB
03.07.2019 02:18
03.07.2019 02:18
1 KB
03.07.2019 02:18
03.07.2019 02:18
3 KB
03.07.2019 02:18
03.07.2019 02:18
1 KB
03.07.2019 02:18
03.07.2019 02:18
1 KB
03.07.2019 02:18
03.07.2019 02:18
2 KB
03.07.2019 02:18
03.07.2019 02:18
10 KB
03.07.2019 02:18
03.07.2019 02:18
README.MD

Mockery

Build Status Latest Stable Version Coverage Status Total Downloads

Mockery is a simple yet flexible PHP mock object framework for use in unit testing with PHPUnit, PHPSpec or any other testing framework. Its core goal is to offer a test double framework with a succinct API capable of clearly defining all possible object operations and interactions using a human readable Domain Specific Language (DSL). Designed as a drop in alternative to PHPUnit's phpunit-mock-objects library, Mockery is easy to integrate with PHPUnit and can operate alongside phpunit-mock-objects without the World ending.

Mockery is released under a New BSD License.

Installation

To install Mockery, run the command below and you will get the latest version

composer require --dev mockery/mockery

Documentation

In older versions, this README file was the documentation for Mockery. Over time we have improved this, and have created an extensive documentation for you. Please use this README file as a starting point for Mockery, but do read the documentation to learn how to use Mockery.

The current version can be seen at docs.mockery.io.

Test Doubles

Test doubles (often called mocks) simulate the behaviour of real objects. They are commonly utilised to offer test isolation, to stand in for objects which do not yet exist, or to allow for the exploratory design of class APIs without requiring actual implementation up front.

The benefits of a test double framework are to allow for the flexible generation and configuration of test doubles. They allow the setting of expected method calls and/or return values using a flexible API which is capable of capturing every possible real object behaviour in way that is stated as close as possible to a natural language description. Use the Mockery::mock method to create a test double.

$double = Mockery::mock();

If you need Mockery to create a test double to satisfy a particular type hint, you can pass the type to the mock method.

class Book {}

interface BookRepository {
    function find($id): Book;
    function findAll(): array;
    function add(Book $book): void;
}

$double = Mockery::mock(BookRepository::class);

A detailed explanation of creating and working with test doubles is given in the documentation, Creating test doubles section.

Method Stubs 🎫

A method stub is a mechanism for having your test double return canned responses to certain method calls. With stubs, you don't care how many times, if at all, the method is called. Stubs are used to provide indirect input to the system under test.

$double->allows()->find(123)->andReturns(new Book());

$book = $double->find(123);

If you have used Mockery before, you might see something new in the example above — we created a method stub using allows, instead of the "old" shouldReceive syntax. This is a new feature of Mockery v1, but fear not, the trusty ol' shouldReceive is still here.

For new users of Mockery, the above example can also be written as:

$double->shouldReceive('find')->with(123)->andReturn(new Book());
$book = $double->find(123);

If your stub doesn't require specific arguments, you can also use this shortcut for setting up multiple calls at once:

$double->allows([
    "findAll" => [new Book(), new Book()],
]);

or

$double->shouldReceive('findAll')
    ->andReturn([new Book(), new Book()]);

You can also use this shortcut, which creates a double and sets up some stubs in one call:

$double = Mockery::mock(BookRepository::class, [
    "findAll" => [new Book(), new Book()],
]);

Method Call Expectations 📲

A Method call expectation is a mechanism to allow you to verify that a particular method has been called. You can specify the parameters and you can also specify how many times you expect it to be called. Method call expectations are used to verify indirect output of the system under test.

$book = new Book();

$double = Mockery::mock(BookRepository::class);
$double->expects()->add($book);

During the test, Mockery accept calls to the add method as prescribed. After you have finished exercising the system under test, you need to tell Mockery to check that the method was called as expected, using the Mockery::close method. One way to do that is to add it to your tearDown method in PHPUnit.


public function tearDown()
{
    Mockery::close();
}

The expects() method automatically sets up an expectation that the method call (and matching parameters) is called once and once only. You can choose to change this if you are expecting more calls.

$double->expects()->add($book)->twice();

If you have used Mockery before, you might see something new in the example above — we created a method expectation using expects, instead of the "old" shouldReceive syntax. This is a new feature of Mockery v1, but same as with accepts in the previous section, it can be written in the "old" style.

For new users of Mockery, the above example can also be written as:

$double->shouldReceive('find')
    ->with(123)
    ->once()
    ->andReturn(new Book());
$book = $double->find(123);

A detailed explanation of declaring expectations on method calls, please read the documentation, the Expectation declarations section. After that, you can also learn about the new allows and expects methods in the Alternative shouldReceive syntax section.

It is worth mentioning that one way of setting up expectations is no better or worse than the other. Under the hood, allows and expects are doing the same thing as shouldReceive, at times in "less words", and as such it comes to a personal preference of the programmer which way to use.

Test Spies 🕵️

By default, all test doubles created with the Mockery::mock method will only accept calls that they have been configured to allow or expect (or in other words, calls that they shouldReceive). Sometimes we don't necessarily care about all of the calls that are going to be made to an object. To facilitate this, we can tell Mockery to ignore any calls it has not been told to expect or allow. To do so, we can tell a test double shouldIgnoreMissing, or we can create the double using the Mocker::spy shortcut.

// $double = Mockery::mock()->shouldIgnoreMissing();
$double = Mockery::spy();

$double->foo(); // null
$double->bar(); // null

Further to this, sometimes we want to have the object accept any call during the test execution and then verify the calls afterwards. For these purposes, we need our test double to act as a Spy. All mockery test doubles record the calls that are made to them for verification afterwards by default:

$double->baz(123);

$double->shouldHaveReceived()->baz(123); // null
$double->shouldHaveReceived()->baz(12345); // Uncaught Exception Mockery\Exception\InvalidCountException...

Please refer to the Spies section of the documentation to learn more about the spies.

Utilities 🔌

Global Helpers

Mockery ships with a handful of global helper methods, you just need to ask Mockery to declare them.

Mockery::globalHelpers();

$mock = mock(Some::class);
$spy = spy(Some::class);

$spy->shouldHaveReceived()
    ->foo(anyArgs());

All of the global helpers are wrapped in a !function_exists call to avoid conflicts. So if you already have a global function called spy, Mockery will silently skip the declaring its own spy function.

Testing Traits

As Mockery ships with code generation capabilities, it was trivial to add functionality allowing users to create objects on the fly that use particular traits. Any abstract methods defined by the trait will be created and can have expectations or stubs configured like normal Test Doubles.

trait Foo {
    function foo() {
        return $this->doFoo();
    }

    abstract function doFoo();
}

$double = Mockery::mock(Foo::class);
$double->allows()->doFoo()->andReturns(123);
$double->foo(); // int(123)

Testing the constructor arguments of hard Dependencies

See Mocking hard dependencies

$implementationMock = Mockery::mock('overload:\Some\Implementation');

$implementationMock->shouldReceive('__construct')
    ->once()
    ->with(['host' => 'localhost']);
// add other expectations as usual

$implementation = new \Some\Implementation(['host' => 'localhost']);

Versioning

The Mockery team attempts to adhere to Semantic Versioning, however, some of Mockery's internals are considered private and will be open to change at any time. Just because a class isn't final, or a method isn't marked private, does not mean it constitutes part of the API we guarantee under the versioning scheme.

Alternative Runtimes

Mockery will attempt to continue support HHVM, but will not make any guarantees.

A new home for Mockery

⚠️️ Update your remotes! Mockery has transferred to a new location. While it was once at padraic/mockery, it is now at mockery/mockery. While your existing repositories will redirect transparently for any operations, take some time to transition to the new URL.

$ git remote set-url upstream https://github.com/mockery/mockery.git

Replace upstream with the name of the remote you use locally; upstream is commonly used but you may be using something else. Run git remote -v to see what you're actually using.