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.

Mediabox

2024 Test

Test project for media files management.

PHP 8 Laravel 11 Vue.js Composer SQLite
Information
Source code
  app
  Http
  .bin
  vite
  lib
  dist
  esm
  node
  lib
  core
  env
  node
  lib
  lib
  lib
  lib
  dist
  lib
  lib
  dist
  es
  lib
  vite
  dist
  node
  dist
  css
  js
  app
  data
  logs
  Unit
  math
  src
  src
  src
  docs
  en
  lib
  src
  src
  Cron
  src
  src
  Core
  ORM
  Spot
  filp
  src
  css
  js
  Util
  src
  src
  src
  src
  psr7
  src
  src
  Core
  Text
  Type
  Xml
  Core
  Text
  Type
  Xml
  src
  Auth
  make
  Bus
  View
  Auth
  Bus
  Http
  Mail
  View
  Auth
  Bus
  Http
  dist
  Http
  Json
  Log
  Mail
  html
  text
  Jobs
  lang
  en
  View
  pint
  pint
  src
  sail
  8.0
  8.1
  8.2
  8.3
  src
  src
  src
  src
  Node
  Util
  Node
  Node
  Node
  Data
  Node
  Node
  Util
  Xml
  src
  src
  src
  docs
  Pass
  src
  Curl
  Test
  src
  Date
  Spl
  lazy
  src
  Cli
  Lang
  List
  src
  src
  lib
  Node
  Expr
  Cast
  Name
  Stmt
  src
  src
  Html
  src
  xml
  src
  src
  src
  Data
  Node
  Html
  css
  js
  Xml
  Util
  src
  src
  src
  src
  src
  Test
  Test
  Math
  Type
  Api
  Rule
  Stub
  Api
  PHPT
  Cli
  Xml
  Util
  PHP
  Xml
  psr
  src
  src
  src
  src
  src
  docs
  src
  log
  src
  src
  psy
  src
  Hoa
  77
  78
  Sudo
  Util
  src
  src
  Map
  Tool
  uuid
  src
  Time
  Guid
  Lazy
  Math
  Dce
  Node
  Time
  Type
  src
  src
  src
  src
  src
  diff
  src
  src
  src
  src
  src
  src
  src
  src
  type
  src
  type
  src
  Test
  CI
  Node
  css
  js
  File
  Test
  Log
  Test
  Smtp
  Auth
  mime
  Part
  Test
  Test
  data
  data
  Test
  Util
  Test
  uid
  css
  js
  Test
  yaml
  Tag
  src
  src
  Css
  Rule
  src
  File
  Util
  voku
  src
  voku
  data
  src
  .env
Root / vendor / hamcrest / hamcrest-php
Name
Size
Date created
Date modified
25.08.2024 16:05
25.08.2024 16:05
25.08.2024 16:05
25.08.2024 16:05
25.08.2024 16:05
25.08.2024 16:05
25.08.2024 16:05
25.08.2024 16:05
18 bytes
25.08.2024 16:05
09.07.2020 11:09
21 bytes
25.08.2024 16:05
09.07.2020 11:09
184 bytes
25.08.2024 16:05
09.07.2020 11:09
380 bytes
25.08.2024 16:05
09.07.2020 11:09
5 KB
25.08.2024 16:05
09.07.2020 11:09
678 bytes
25.08.2024 16:05
09.07.2020 11:09
1 KB
25.08.2024 16:05
09.07.2020 11:09
11 KB
25.08.2024 16:05
09.07.2020 11:09
README.MD

This is the PHP port of Hamcrest Matchers

Build Status

Hamcrest is a matching library originally written for Java, but subsequently ported to many other languages. hamcrest-php is the official PHP port of Hamcrest and essentially follows a literal translation of the original Java API for Hamcrest, with a few Exceptions, mostly down to PHP language barriers:

  1. instanceOf($theClass) is actually anInstanceOf($theClass)

  2. both(containsString('a'))->and(containsString('b')) is actually both(containsString('a'))->andAlso(containsString('b'))

  3. either(containsString('a'))->or(containsString('b')) is actually either(containsString('a'))->orElse(containsString('b'))

  4. Unless it would be non-semantic for a matcher to do so, hamcrest-php allows dynamic typing for it's input, in "the PHP way". Exception are where semantics surrounding the type itself would suggest otherwise, such as stringContains() and greaterThan().

  5. Several official matchers have not been ported because they don't make sense or don't apply in PHP:

    • typeCompatibleWith($theClass)
    • eventFrom($source)
    • hasProperty($name) **
    • samePropertyValuesAs($obj) **
  6. When most of the collections matchers are finally ported, PHP-specific aliases will probably be created due to a difference in naming conventions between Java's Arrays, Collections, Sets and Maps compared with PHP's Arrays.


** [Unless we consider POPO's (Plain Old PHP Objects) akin to JavaBeans] - The POPO thing is a joke. Java devs coin the term POJO's (Plain Old Java Objects).

Usage

Hamcrest matchers are easy to use as:

Hamcrest_MatcherAssert::assertThat('a', Hamcrest_Matchers::equalToIgnoringCase('A'));

Alternatively, you can use the global proxy-functions:

$result = true;
// with an identifier
assertThat("result should be true", $result, equalTo(true));

// without an identifier
assertThat($result, equalTo(true));

// evaluate a boolean expression
assertThat($result === true);

// with syntactic sugar is()
assertThat(true, is(true));

:warning: NOTE: the global proxy-functions aren't autoloaded by default, so you will need to load them first:

\Hamcrest\Util::registerGlobalFunctions();

For brevity, all of the examples below use the proxy-functions.

Documentation

A tutorial can be found on the Hamcrest site.

Available Matchers

Array

  • anArray - evaluates an array
assertThat([], anArray());
  • hasItemInArray - check if item exists in array
$list = range(2, 7, 2);
$item = 4;
assertThat($list, hasItemInArray($item));
  • hasValue - alias of hasItemInArray

  • arrayContainingInAnyOrder - check if array contains elements in any order

assertThat([2, 4, 6], arrayContainingInAnyOrder([6, 4, 2]));
assertThat([2, 4, 6], arrayContainingInAnyOrder([4, 2, 6]));
  • containsInAnyOrder - alias of arrayContainingInAnyOrder

  • arrayContaining - An array with elements that match the given matchers in the same order.

assertThat([2, 4, 6], arrayContaining([2, 4, 6]));
assertthat([2, 4, 6], not(arrayContaining([6, 4, 2])));
  • contains - check array in same order
assertThat([2, 4, 6], contains([2, 4, 6]));
  • hasKeyInArray - check if array has given key
assertThat(['name'=> 'foobar'], hasKeyInArray('name'));
  • hasKey - alias of hasKeyInArray

  • hasKeyValuePair - check if arary has given key, value pair

assertThat(['name'=> 'foobar'], hasKeyValuePair('name', 'foobar'));
  • hasEntry - same as hasKeyValuePair

  • arrayWithSize - check array has given size

assertthat([2, 4, 6], arrayWithSize(3));
  • emptyArray - check if array is emtpy
assertThat([], emptyArray());
  • nonEmptyArray
assertThat([1], nonEmptyArray());

Collection

  • emptyTraversable - check if traversable is empty
$empty_it = new EmptyIterator;
assertThat($empty_it, emptyTraversable());
  • nonEmptyTraversable - check if traversable isn't empty
$non_empty_it = new ArrayIterator(range(1, 10));
assertThat($non_empty_it, nonEmptyTraversable());
a
  • traversableWithSize
$non_empty_it = new ArrayIterator(range(1, 10));
assertThat($non_empty_it, traversableWithSize(count(range(1, 10))));
`

Core

  • allOf - Evaluates to true only if ALL of the passed in matchers evaluate to true.
assertThat([2,4,6], allOf(hasValue(2), arrayWithSize(3)));
  • anyOf - Evaluates to true if ANY of the passed in matchers evaluate to true.
assertThat([2, 4, 6], anyOf(hasValue(8), hasValue(2)));
  • noneOf - Evaluates to false if ANY of the passed in matchers evaluate to true.
assertThat([2, 4, 6], noneOf(hasValue(1), hasValue(3)));
  • both + andAlso - This is useful for fluently combining matchers that must both pass.
assertThat([2, 4, 6], both(hasValue(2))->andAlso(hasValue(4)));
  • either + orElse - This is useful for fluently combining matchers where either may pass,
assertThat([2, 4, 6], either(hasValue(2))->orElse(hasValue(4)));
  • describedAs - Wraps an existing matcher and overrides the description when it fails.
$expected = "Dog";
$found = null;
// this assertion would result error message as Expected: is not null but: was null
//assertThat("Expected {$expected}, got {$found}", $found, is(notNullValue()));
// and this assertion would result error message as Expected: Dog but: was null
//assertThat($found, describedAs($expected, notNullValue()));
  • everyItem - A matcher to apply to every element in an array.
assertThat([2, 4, 6], everyItem(notNullValue()));
  • hasItem - check array has given item, it can take a matcher argument
assertThat([2, 4, 6], hasItem(equalTo(2)));
  • hasItems - check array has givem items, it can take multiple matcher as arguments
assertThat([1, 3, 5], hasItems(equalTo(1), equalTo(3)));

Object

  • hasToString - check __toString or toString method
class Foo {
    public $name = null;

    public function __toString() {
        return "[Foo]Instance";
    }
}
$foo = new Foo;
assertThat($foo, hasToString(equalTo("[Foo]Instance")));
  • equalTo - compares two instances using comparison operator '=='
$foo = new Foo;
$foo2 = new Foo;
assertThat($foo, equalTo($foo2));
  • identicalTo - compares two instances using identity operator '==='
assertThat($foo, is(not(identicalTo($foo2))));
  • anInstanceOf - check instance is an instance|sub-class of given class
assertThat($foo, anInstanceOf(Foo::class));
  • any - alias of anInstanceOf

  • nullValue check null

assertThat(null, is(nullValue()));
  • notNullValue check not null
assertThat("", notNullValue());
  • sameInstance - check for same instance
assertThat($foo, is(not(sameInstance($foo2))));
assertThat($foo, is(sameInstance($foo)));
  • typeOf- check type
assertThat(1, typeOf("integer"));
  • notSet - check if instance property is not set
assertThat($foo, notSet("name"));
  • set - check if instance property is set
$foo->name = "bar";
assertThat($foo, set("name"));

Numbers

  • closeTo - check value close to a range
assertThat(3, closeTo(3, 0.5));
  • comparesEqualTo - check with '=='
assertThat(2, comparesEqualTo(2));
  • greaterThan - check '>'
assertThat(2, greaterThan(1));
  • greaterThanOrEqualTo
assertThat(2, greaterThanOrEqualTo(2));
  • atLeast - The value is >= given value
assertThat(3, atLeast(2));
  • lessThan
assertThat(2, lessThan(3));
  • lessThanOrEqualTo
assertThat(2, lessThanOrEqualTo(3));
  • atMost - The value is <= given value
assertThat(2, atMost(3));

String

  • emptyString - check for empty string
assertThat("", emptyString());
  • isEmptyOrNullString
assertThat(null, isEmptyOrNullString());
  • nullOrEmptyString
assertThat("", nullOrEmptyString());
  • isNonEmptyString
assertThat("foo", isNonEmptyString());
  • nonEmptyString
assertThat("foo", nonEmptyString());
  • equalToIgnoringCase
assertThat("Foo", equalToIgnoringCase("foo"));
  • equalToIgnoringWhiteSpace
assertThat(" Foo ", equalToIgnoringWhiteSpace("Foo"));
  • matchesPattern - matches with regex pattern
assertThat("foobarbaz", matchesPattern('/(foo)(bar)(baz)/'));
  • containsString - check for substring
assertThat("foobar", containsString("foo"));
  • containsStringIgnoringCase
assertThat("fooBar", containsStringIgnoringCase("bar"));
  • stringContainsInOrder
assertThat("foo", stringContainsInOrder("foo"));
  • endsWith - check string that ends with given value
assertThat("foo", endsWith("oo"));
  • startsWith - check string that starts with given value
assertThat("bar", startsWith("ba"));

Type-checking

  • arrayValue - check array type
assertThat([], arrayValue());
  • booleanValue
assertThat(true, booleanValue());
  • boolValue - alias of booleanValue

  • callableValue - check if value is callable

$func = function () {};
assertThat($func, callableValue());
  • doubleValue
assertThat(3.14, doubleValue());
  • floatValue
assertThat(3.14, floatValue());
  • integerValue
assertThat(1, integerValue());
  • intValue - alias of integerValue

  • numericValue - check if value is numeric

assertThat("123", numericValue());
  • objectValue - check for object
$obj = new stdClass;
assertThat($obj, objectValue());
  • anObject
assertThat($obj, anObject());
  • resourceValue - check resource type
$fp = fopen("/tmp/foo", "w+");
assertThat($fp, resourceValue());
  • scalarValue - check for scaler value
assertThat(1, scalarValue());
  • stringValue
assertThat("", stringValue());

XML

  • hasXPath - check xml with a xpath
$xml = <<<XML
<books>
  <book>
    <isbn>1</isbn>   
  </book>
  <book>
    <isbn>2</isbn>   
  </book>
</books>
XML;

$doc = new DOMDocument;
$doc->loadXML($xml);
assertThat($doc, hasXPath("book", 2));