Skip to content

Commit

Permalink
[MERGE] pull request #70 from Learnosity/PSRE-2138/feature/pre-hash-s…
Browse files Browse the repository at this point in the history
…tring-utils

Psre 2138/feature/pre hash string utils PSRE-2229
  • Loading branch information
shtrom authored Apr 10, 2024
2 parents d26e587 + 49c0fc7 commit 2c05853
Show file tree
Hide file tree
Showing 33 changed files with 1,554 additions and 930 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/push-pr-main-test-lint-unit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#####
# Pull Request workflow triggers on pushes to, or pull requests against, main
# Jobs performed:
# 1. Lint
# 2. Unit test
# 3. Integration tests
#####
name: Tests
on:
pull_request:
branches:
- master
push:
branches:
# Every push on those branches
- master

jobs:
run_tests:
runs-on: ubuntu-latest
name: Lint & Tests
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Run Lint Checks
run: make lint
- name: Run Python Tests
run: make test-unit
- name: Run Integration Test
run: make test-integration-env
5 changes: 5 additions & 0 deletions .phpcs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0"?>
<ruleset name="PHP_CodeSniffer">
<description>PHP_CodeSniffer configuration</description>
<rule ref="PSR12"/>
</ruleset>
9 changes: 4 additions & 5 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@ and this project adheres to [Semantic
Versioning](http://semver.org/spec/v2.0.0.html).

## [Unreleased]
## [v1.0.3] - 2024-04-07
### Added
- Rename author-aide to authoraide
- Added composable services for signature generation.
- Support authoraide.

### Refactor
- Refactored the signature generation to use composable services.

## [v1.0.3] - 2024-03-07
### Added
- Support author aide

## [v1.0.2] - 2023-07-03
### Added
Expand Down
20 changes: 14 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
ARGS_PHPUNIT ?=

DOCKER := $(if $(LRN_SDK_NO_DOCKER),,$(shell which docker))
PHP_VERSION = 8.3
DEBIAN_VERSION = bookworm
IMAGE = php-cli-composer:$(PHP_VERSION)

TARGETS = all build devbuild prodbuild \
quickstart install-vendor \
quickstart check-quickstart install-vendor \
dist dist-test dist-zip release \
test test-coverage test-integration-env test-unit \
lint test test-coverage test-integration-env test-unit \
clean clean-dist clean-test clean-vendor
.PHONY: $(TARGETS)
.default: all
Expand Down Expand Up @@ -37,6 +39,7 @@ DIST = $(DIST_PREFIX)$(SRC_VERSION)
COMPOSER = composer
COMPOSER_INSTALL_FLAGS = --no-interaction --optimize-autoloader --classmap-authoritative

PHPCS= ./vendor/bin/phpcs
PHPUNIT = ./vendor/bin/phpunit

###
Expand All @@ -46,6 +49,8 @@ quickstart: VENDOR_FLAGS = --no-dev
quickstart: install-vendor
cd docs/quickstart && php -S $(LOCALHOST):8000

check-quickstart: vendor/autoload.php
$(COMPOSER) install $(COMPOSER_INSTALL_FLAGS) --no-dev;
###
# internal tooling rules
####
Expand All @@ -59,17 +64,20 @@ prodbuild: install-vendor
release:
@./release.sh

lint: install-vendor
$(PHPCS) src

test: install-vendor
$(PHPUNIT) --do-not-cache-result
$(PHPUNIT) --do-not-cache-result $(ARGS_PHPUNIT)

test-coverage: install-vendor
XDEBUG_MODE=coverage $(PHPUNIT) --do-not-cache-result
XDEBUG_MODE=coverage $(PHPUNIT) --do-not-cache-result $(ARGS_PHPUNIT)

test-unit: install-vendor
$(PHPUNIT) --do-not-cache-result --testsuite unit
$(PHPUNIT) --do-not-cache-result --testsuite unit $(ARGS_PHPUNIT)

test-integration-env: install-vendor
$(PHPUNIT) --do-not-cache-result --testsuite integration
$(PHPUNIT) --do-not-cache-result --testsuite integration $(ARGS_PHPUNIT)

###
# dist rules
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"ext-mbstring": "*"
},
"require-dev": {
"phpunit/phpunit": "^6.0 || ^7.0 || ^8.0 || ^9.0"
"phpunit/phpunit": "^6.0 || ^7.0 || ^8.0 || ^9.0",
"squizlabs/php_codesniffer": "*"
}
}
3 changes: 2 additions & 1 deletion docs/quickstart/analytics/basic_data.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<?php

/* Copyright (c) 2023 Learnosity, MIT License
* Basic example code for pulling information from the Learnosity cloud using Data API. */

// Setup to load the necessary classes from the example directory, & set up variables for access.
require_once __DIR__ . '/../../../bootstrap.php';
require_once __DIR__ . '/../../../bootstrap.php';
$config = require_once __DIR__ . '/../config.php'; // Load security keys from config.php, for Learnosity's public demos account.
use LearnositySdk\Request\DataApi; // Load core Data API library.
$itembank_uri = 'https://data.learnosity.com/v2023.1.LTS/sessions/responses'; // Choosing the Data API endpoint for sessions/responses.
Expand Down
1 change: 1 addition & 0 deletions docs/quickstart/analytics/init_data.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* Copyright (c) 2021 Learnosity, MIT License
*
Expand Down
6 changes: 4 additions & 2 deletions docs/quickstart/analytics/student-reporting.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* Copyright (c) 2021 Learnosity, MIT License
*
Expand Down Expand Up @@ -55,9 +56,10 @@
'reports',
$security,
$consumerSecret,
$request);
$request
);
$initOptions = $init->generate();
?>
?>

<!-- Section 2: Web page content. -->
<!DOCTYPE html>
Expand Down
6 changes: 4 additions & 2 deletions docs/quickstart/assessment/standalone-assessment.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* Copyright (c) 2021 Learnosity, MIT License
*
Expand Down Expand Up @@ -60,9 +61,10 @@
'items',
$security,
$consumerSecret,
$request);
$request
);
$initOptions = $init->generate(); // JSON blob of signed config params.
?>
?>

<!-- Section 2: Web page content. -->
<!DOCTYPE html>
Expand Down
6 changes: 4 additions & 2 deletions docs/quickstart/authoring/authoring-activities.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* Copyright (c) 2021 Learnosity, MIT License
*
Expand Down Expand Up @@ -40,9 +41,10 @@
'author',
$security,
$consumerSecret,
$request);
$request
);
$initOptions = $init->generate();
?>
?>

<!-- Section 2: Web page content. -->
<!DOCTYPE html>
Expand Down
6 changes: 4 additions & 2 deletions docs/quickstart/authoring/authoring-items.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* Copyright (c) 2021 Learnosity, MIT License
*
Expand Down Expand Up @@ -41,9 +42,10 @@
'author',
$security,
$consumerSecret,
$request);
$request
);
$initOptions = $init->generate(); // JSON blob of signed config params.
?>
?>

<!-- Section 2: Web page content. -->
<!DOCTYPE html>
Expand Down
5 changes: 3 additions & 2 deletions docs/quickstart/config.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<?php

// The consumerKey and consumerSecret are the public & private
// security keys required to access Learnosity APIs and
// data. Learnosity will provide keys for your own private account.
// Note: The consumer secret should be in a properly secured credential store,
// and *NEVER* checked into version control.
// Note: The consumer secret should be in a properly secured credential store,
// and *NEVER* checked into version control.
// The keys listed here grant access to Learnosity's public demos account.
return [
'consumerKey' => 'yis0TYCu7U9V4o7M',
Expand Down
36 changes: 14 additions & 22 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,30 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
backupGlobals="false"
backupStaticAttributes="false"
bootstrap="bootstrap.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" backupStaticAttributes="false" bootstrap="bootstrap.php" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage>
<include>
<directory suffix=".php">./src/</directory>
</include>
<report>
<clover outputFile="./tests/coverage.xml"/>
<html outputDirectory="./tests/coverage" lowUpperBound="35" highLowerBound="70"/>
</report>
</coverage>
<php>
<ini name="intl.default_locale" value="en" />
<ini name="intl.error_level" value="0" />
<ini name="memory_limit" value="-1" />
<ini name="intl.default_locale" value="en"/>
<ini name="intl.error_level" value="0"/>
<ini name="memory_limit" value="-1"/>
</php>
<logging>
<log type="coverage-html" target="./tests/coverage" lowUpperBound="35" highLowerBound="70" />
<log type="coverage-clover" target="./tests/coverage.xml" />
<log type="junit" target="./tests/junit.xml" />
<junit outputFile="./tests/junit.xml"/>
</logging>
<filter>
<whitelist>
<directory suffix=".php">./src/</directory>
</whitelist>
</filter>
<testsuites>
<testsuite name="unit">
<directory>./tests/</directory>
Expand Down
2 changes: 1 addition & 1 deletion src/Exceptions/ValidationException.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php

namespace LearnositySdk\Exceptions;

use Exception;

class ValidationException extends Exception
{

}
Loading

0 comments on commit 2c05853

Please sign in to comment.