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 9 • 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 / docs / reference / expectations.rst
.. index:: single: Expectations Expectation Declarations ======================== .. note:: In order for our expectations to work we MUST call ``Mockery::close()``, preferably in a callback method such as ``tearDown`` or ``_before`` (depending on whether or not we're integrating Mockery with another framework). This static call cleans up the Mockery container used by the current test, and run any verification tasks needed for our expectations. Once we have created a mock object, we'll often want to start defining how exactly it should behave (and how it should be called). This is where the Mockery expectation declarations take over. Declaring Method Call Expectations ---------------------------------- To tell our test double to expect a call for a method with a given name, we use the ``shouldReceive`` method: .. code-block:: php $mock = \Mockery::mock('MyClass'); $mock->shouldReceive('name_of_method'); This is the starting expectation upon which all other expectations and constraints are appended. We can declare more than one method call to be expected: .. code-block:: php $mock = \Mockery::mock('MyClass'); $mock->shouldReceive('name_of_method_1', 'name_of_method_2'); All of these will adopt any chained expectations or constraints. It is possible to declare the expectations for the method calls, along with their return values: .. code-block:: php $mock = \Mockery::mock('MyClass'); $mock->shouldReceive([ 'name_of_method_1' => 'return value 1', 'name_of_method_2' => 'return value 2', ]); There's also a shorthand way of setting up method call expectations and their return values: .. code-block:: php $mock = \Mockery::mock('MyClass', ['name_of_method_1' => 'return value 1', 'name_of_method_2' => 'return value 2']); All of these will adopt any additional chained expectations or constraints. We can declare that a test double should not expect a call to the given method name: .. code-block:: php $mock = \Mockery::mock('MyClass'); $mock->shouldNotReceive('name_of_method'); This method is a convenience method for calling ``shouldReceive()->never()``. Declaring Method Argument Expectations -------------------------------------- For every method we declare expectation for, we can add constraints that the defined expectations apply only to the method calls that match the expected argument list: .. code-block:: php $mock = \Mockery::mock('MyClass'); $mock->shouldReceive('name_of_method') ->with($arg1, $arg2, ...); // or $mock->shouldReceive('name_of_method') ->withArgs([$arg1, $arg2, ...]); We can add a lot more flexibility to argument matching using the built in matcher classes (see later). For example, ``\Mockery::any()`` matches any argument passed to that position in the ``with()`` parameter list. Mockery also allows Hamcrest library matchers - for example, the Hamcrest function ``anything()`` is equivalent to ``\Mockery::any()``. It's important to note that this means all expectations attached only apply to the given method when it is called with these exact arguments: .. code-block:: php $mock = \Mockery::mock('MyClass'); $mock->shouldReceive('foo')->with('Hello'); $mock->foo('Goodbye'); // throws a NoMatchingExpectationException This allows for setting up differing expectations based on the arguments provided to expected calls. Argument matching with closures ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Instead of providing a built-in matcher for each argument, we can provide a closure that matches all passed arguments at once: .. code-block:: php $mock = \Mockery::mock('MyClass'); $mock->shouldReceive('name_of_method') ->withArgs(closure); The given closure receives all the arguments passed in the call to the expected method. In this way, this expectation only applies to method calls where passed arguments make the closure evaluate to true: .. code-block:: php $mock = \Mockery::mock('MyClass'); $mock->shouldReceive('foo')->withArgs(function ($arg) { if ($arg % 2 == 0) { return true; } return false; }); $mock->foo(4); // matches the expectation $mock->foo(3); // throws a NoMatchingExpectationException Any, or no arguments ^^^^^^^^^^^^^^^^^^^^ We can declare that the expectation matches a method call regardless of what arguments are passed: .. code-block:: php $mock = \Mockery::mock('MyClass'); $mock->shouldReceive('name_of_method') ->withAnyArgs(); This is set by default unless otherwise specified. We can declare that the expectation matches method calls with zero arguments: .. code-block:: php $mock = \Mockery::mock('MyClass'); $mock->shouldReceive('name_of_method') ->withNoArgs(); Declaring Return Value Expectations ----------------------------------- For mock objects, we can tell Mockery what return values to return from the expected method calls. For that we can use the ``andReturn()`` method: .. code-block:: php $mock = \Mockery::mock('MyClass'); $mock->shouldReceive('name_of_method') ->andReturn($value); This sets a value to be returned from the expected method call. It is possible to set up expectation for multiple return values. By providing a sequence of return values, we tell Mockery what value to return on every subsequent call to the method: .. code-block:: php $mock = \Mockery::mock('MyClass'); $mock->shouldReceive('name_of_method') ->andReturn($value1, $value2, ...) The first call will return ``$value1`` and the second call will return ``$value2``. If we call the method more times than the number of return values we declared, Mockery will return the final value for any subsequent method call: .. code-block:: php $mock = \Mockery::mock('MyClass'); $mock->shouldReceive('foo')->andReturn(1, 2, 3); $mock->foo(); // int(1) $mock->foo(); // int(2) $mock->foo(); // int(3) $mock->foo(); // int(3) The same can be achieved using the alternative syntax: .. code-block:: php $mock = \Mockery::mock('MyClass'); $mock->shouldReceive('name_of_method') ->andReturnValues([$value1, $value2, ...]) It accepts a simple array instead of a list of parameters. The order of return is determined by the numerical index of the given array with the last array member being returned on all calls once previous return values are exhausted. The following two options are primarily for communication with test readers: .. code-block:: php $mock = \Mockery::mock('MyClass'); $mock->shouldReceive('name_of_method') ->andReturnNull(); // or $mock->shouldReceive('name_of_method') ->andReturn([null]); They mark the mock object method call as returning ``null`` or nothing. Sometimes we want to calculate the return results of the method calls, based on the arguments passed to the method. We can do that with the ``andReturnUsing()`` method which accepts one or more closure: .. code-block:: php $mock = \Mockery::mock('MyClass'); $mock->shouldReceive('name_of_method') ->andReturnUsing(closure, ...); Closures can be queued by passing them as extra parameters as for ``andReturn()``. .. note:: We cannot currently mix ``andReturnUsing()`` with ``andReturn()``. If we are mocking fluid interfaces, the following method will be helpful: .. code-block:: php $mock = \Mockery::mock('MyClass'); $mock->shouldReceive('name_of_method') ->andReturnSelf(); It sets the return value to the mocked class name. Throwing Exceptions ------------------- We can tell the method of mock objects to throw exceptions: .. code-block:: php $mock = \Mockery::mock('MyClass'); $mock->shouldReceive('name_of_method') ->andThrow(Exception); It will throw the given ``Exception`` object when called. Rather than an object, we can pass in the ``Exception`` class and message to use when throwing an ``Exception`` from the mocked method: .. code-block:: php $mock = \Mockery::mock('MyClass'); $mock->shouldReceive('name_of_method') ->andThrow('exception_name', 'message'); .. _expectations-setting-public-properties: Setting Public Properties ------------------------- Used with an expectation so that when a matching method is called, we can cause a mock object's public property to be set to a specified value, by using ``andSet()`` or ``set()``: .. code-block:: php $mock = \Mockery::mock('MyClass'); $mock->shouldReceive('name_of_method') ->andSet($property, $value); // or $mock->shouldReceive('name_of_method') ->set($property, $value); In cases where we want to call the real method of the class that was mocked and return its result, the ``passthru()`` method tells the expectation to bypass a return queue: .. code-block:: php passthru() It allows expectation matching and call count validation to be applied against real methods while still calling the real class method with the expected arguments. Declaring Call Count Expectations --------------------------------- Besides setting expectations on the arguments of the method calls, and the return values of those same calls, we can set expectations on how many times should any method be called. When a call count expectation is not met, a ``\Mockery\Expectation\InvalidCountException`` will be thrown. .. note:: It is absolutely required to call ``\Mockery::close()`` at the end of our tests, for example in the ``tearDown()`` method of PHPUnit. Otherwise Mockery will not verify the calls made against our mock objects. We can declare that the expected method may be called zero or more times: .. code-block:: php $mock = \Mockery::mock('MyClass'); $mock->shouldReceive('name_of_method') ->zeroOrMoreTimes(); This is the default for all methods unless otherwise set. To tell Mockery to expect an exact number of calls to a method, we can use the following: .. code-block:: php $mock = \Mockery::mock('MyClass'); $mock->shouldReceive('name_of_method') ->times($n); where ``$n`` is the number of times the method should be called. A couple of most common cases got their shorthand methods. To declare that the expected method must be called one time only: .. code-block:: php $mock = \Mockery::mock('MyClass'); $mock->shouldReceive('name_of_method') ->once(); To declare that the expected method must be called two times: .. code-block:: php $mock = \Mockery::mock('MyClass'); $mock->shouldReceive('name_of_method') ->twice(); To declare that the expected method must never be called: .. code-block:: php $mock = \Mockery::mock('MyClass'); $mock->shouldReceive('name_of_method') ->never(); Call count modifiers ^^^^^^^^^^^^^^^^^^^^ The call count expectations can have modifiers set. If we want to tell Mockery the minimum number of times a method should be called, we use ``atLeast()``: .. code-block:: php $mock = \Mockery::mock('MyClass'); $mock->shouldReceive('name_of_method') ->atLeast() ->times(3); ``atLeast()->times(3)`` means the call must be called at least three times (given matching method args) but never less than three times. Similarly, we can tell Mockery the maximum number of times a method should be called, using ``atMost()``: .. code-block:: php $mock = \Mockery::mock('MyClass'); $mock->shouldReceive('name_of_method') ->atMost() ->times(3); ``atMost()->times(3)`` means the call must be called no more than three times. If the method gets no calls at all, the expectation will still be met. We can also set a range of call counts, using ``between()``: .. code-block:: php $mock = \Mockery::mock('MyClass'); $mock->shouldReceive('name_of_method') ->between($min, $max); This is actually identical to using ``atLeast()->times($min)->atMost()->times($max)`` but is provided as a shorthand. It may be followed by a ``times()`` call with no parameter to preserve the APIs natural language readability. Expectation Declaration Utilities --------------------------------- Declares that this method is expected to be called in a specific order in relation to similarly marked methods. .. code-block:: php ordered() The order is dictated by the order in which this modifier is actually used when setting up mocks. Declares the method as belonging to an order group (which can be named or numbered). Methods within a group can be called in any order, but the ordered calls from outside the group are ordered in relation to the group: .. code-block:: php ordered(group) We can set up so that method1 is called before group1 which is in turn called before method2. When called prior to ``ordered()`` or ``ordered(group)``, it declares this ordering to apply across all mock objects (not just the current mock): .. code-block:: php globally() This allows for dictating order expectations across multiple mocks. The ``byDefault()`` marks an expectation as a default. Default expectations are applied unless a non-default expectation is created: .. code-block:: php byDefault() These later expectations immediately replace the previously defined default. This is useful so we can setup default mocks in our unit test ``setup()`` and later tweak them in specific tests as needed. Returns the current mock object from an expectation chain: .. code-block:: php getMock() Useful where we prefer to keep mock setups as a single statement, e.g.: .. code-block:: php $mock = \Mockery::mock('foo')->shouldReceive('foo')->andReturn(1)->getMock();